@ldraney/github-mcp 0.1.0 → 0.2.0-beta.1
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/dist/index.js +8 -2
- package/dist/prompts/activity-summary.d.ts +10 -0
- package/dist/prompts/activity-summary.js +154 -0
- package/dist/prompts/code-review.d.ts +9 -0
- package/dist/prompts/code-review.js +145 -0
- package/dist/prompts/issue-triage.d.ts +9 -0
- package/dist/prompts/issue-triage.js +202 -0
- package/dist/prompts/release-notes.d.ts +9 -0
- package/dist/prompts/release-notes.js +236 -0
- package/dist/server.d.ts +8 -1
- package/dist/server.js +36 -210
- package/dist/tools/categories/actions.d.ts +2 -5
- package/dist/tools/categories/actions.js +640 -369
- package/dist/tools/categories/activity.d.ts +2 -0
- package/dist/tools/categories/activity.js +534 -0
- package/dist/tools/categories/apps.d.ts +2 -0
- package/dist/tools/categories/apps.js +224 -0
- package/dist/tools/categories/billing.d.ts +2 -0
- package/dist/tools/categories/billing.js +145 -0
- package/dist/tools/categories/checks.d.ts +2 -0
- package/dist/tools/categories/checks.js +554 -0
- package/dist/tools/categories/codeScanning.d.ts +2 -0
- package/dist/tools/categories/codeScanning.js +375 -0
- package/dist/tools/categories/codeSecurity.d.ts +2 -0
- package/dist/tools/categories/codeSecurity.js +463 -0
- package/dist/tools/categories/codesOfConduct.d.ts +2 -0
- package/dist/tools/categories/codesOfConduct.js +45 -0
- package/dist/tools/categories/codespaces.d.ts +2 -0
- package/dist/tools/categories/codespaces.js +259 -0
- package/dist/tools/categories/copilot.d.ts +2 -0
- package/dist/tools/categories/copilot.js +187 -0
- package/dist/tools/categories/dependabot.d.ts +2 -0
- package/dist/tools/categories/dependabot.js +454 -0
- package/dist/tools/categories/emojis.d.ts +2 -0
- package/dist/tools/categories/emojis.js +22 -0
- package/dist/tools/categories/gists.d.ts +2 -5
- package/dist/tools/categories/gists.js +474 -285
- package/dist/tools/categories/git.d.ts +2 -0
- package/dist/tools/categories/git.js +520 -0
- package/dist/tools/categories/gitignore.d.ts +2 -0
- package/dist/tools/categories/gitignore.js +45 -0
- package/dist/tools/categories/index.d.ts +33 -0
- package/dist/tools/categories/index.js +33 -0
- package/dist/tools/categories/interactions.d.ts +2 -0
- package/dist/tools/categories/interactions.js +184 -0
- package/dist/tools/categories/issues.d.ts +2 -5
- package/dist/tools/categories/issues.js +692 -390
- package/dist/tools/categories/licenses.d.ts +2 -0
- package/dist/tools/categories/licenses.js +95 -0
- package/dist/tools/categories/markdown.d.ts +2 -0
- package/dist/tools/categories/markdown.js +64 -0
- package/dist/tools/categories/meta.d.ts +2 -0
- package/dist/tools/categories/meta.js +74 -0
- package/dist/tools/categories/migrations.d.ts +2 -0
- package/dist/tools/categories/migrations.js +290 -0
- package/dist/tools/categories/orgs.d.ts +2 -5
- package/dist/tools/categories/orgs.js +585 -417
- package/dist/tools/categories/packages.d.ts +2 -0
- package/dist/tools/categories/packages.js +918 -0
- package/dist/tools/categories/projects.d.ts +2 -0
- package/dist/tools/categories/projects.js +692 -0
- package/dist/tools/categories/pulls.d.ts +2 -5
- package/dist/tools/categories/pulls.js +715 -332
- package/dist/tools/categories/rateLimit.d.ts +2 -0
- package/dist/tools/categories/rateLimit.js +22 -0
- package/dist/tools/categories/reactions.d.ts +2 -0
- package/dist/tools/categories/reactions.js +385 -0
- package/dist/tools/categories/repos.d.ts +2 -5
- package/dist/tools/categories/repos.js +844 -366
- package/dist/tools/categories/search.d.ts +2 -5
- package/dist/tools/categories/search.js +294 -196
- package/dist/tools/categories/secretScanning.d.ts +2 -0
- package/dist/tools/categories/secretScanning.js +324 -0
- package/dist/tools/categories/securityAdvisories.d.ts +2 -0
- package/dist/tools/categories/securityAdvisories.js +407 -0
- package/dist/tools/categories/teams.d.ts +2 -0
- package/dist/tools/categories/teams.js +614 -0
- package/dist/tools/categories/users.d.ts +2 -5
- package/dist/tools/categories/users.js +474 -247
- package/dist/tools/generator.d.ts +35 -15
- package/dist/tools/generator.js +113 -57
- package/dist/tools/types.d.ts +63 -0
- package/dist/tools/types.js +17 -0
- package/package.json +1 -1
|
@@ -1,370 +1,753 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { successResult } from '../types.js';
|
|
2
|
+
export const pullsCategory = {
|
|
3
|
+
name: 'pulls',
|
|
4
|
+
description: 'Pull request management tools',
|
|
5
|
+
tools: [
|
|
6
|
+
// list - List pull requests
|
|
7
|
+
{
|
|
8
|
+
definition: {
|
|
9
|
+
name: 'github_pulls_list',
|
|
10
|
+
description: 'List pull requests for a repository',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
owner: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Repository owner',
|
|
17
|
+
},
|
|
18
|
+
repo: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Repository name',
|
|
21
|
+
},
|
|
22
|
+
state: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: ['open', 'closed', 'all'],
|
|
25
|
+
description: 'PR state filter',
|
|
26
|
+
},
|
|
27
|
+
head: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
description: 'Filter by head user/branch (user:ref-name)',
|
|
30
|
+
},
|
|
31
|
+
base: {
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'Filter by base branch',
|
|
34
|
+
},
|
|
35
|
+
sort: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
enum: ['created', 'updated', 'popularity', 'long-running'],
|
|
38
|
+
description: 'Sort field',
|
|
39
|
+
},
|
|
40
|
+
direction: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
enum: ['asc', 'desc'],
|
|
43
|
+
description: 'Sort direction',
|
|
44
|
+
},
|
|
45
|
+
per_page: {
|
|
46
|
+
type: 'number',
|
|
47
|
+
description: 'Results per page (max 100)',
|
|
48
|
+
},
|
|
49
|
+
page: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Page number',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
required: ['owner', 'repo'],
|
|
24
55
|
},
|
|
25
|
-
per_page: { type: 'number' },
|
|
26
|
-
page: { type: 'number' },
|
|
27
56
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
handler: async (octokit, args) => {
|
|
58
|
+
const { data } = await octokit.pulls.list({
|
|
59
|
+
owner: args.owner,
|
|
60
|
+
repo: args.repo,
|
|
61
|
+
state: args.state,
|
|
62
|
+
head: args.head,
|
|
63
|
+
base: args.base,
|
|
64
|
+
sort: args.sort,
|
|
65
|
+
direction: args.direction,
|
|
66
|
+
per_page: args.per_page,
|
|
67
|
+
page: args.page,
|
|
68
|
+
});
|
|
69
|
+
return successResult(data);
|
|
40
70
|
},
|
|
41
|
-
required: ['owner', 'repo', 'pull_number'],
|
|
42
71
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
// get - Get a pull request
|
|
73
|
+
{
|
|
74
|
+
definition: {
|
|
75
|
+
name: 'github_pulls_get',
|
|
76
|
+
description: 'Get a pull request by number',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
owner: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'Repository owner',
|
|
83
|
+
},
|
|
84
|
+
repo: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'Repository name',
|
|
87
|
+
},
|
|
88
|
+
pull_number: {
|
|
89
|
+
type: 'number',
|
|
90
|
+
description: 'Pull request number',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
handler: async (octokit, args) => {
|
|
97
|
+
const { data } = await octokit.pulls.get({
|
|
98
|
+
owner: args.owner,
|
|
99
|
+
repo: args.repo,
|
|
100
|
+
pull_number: args.pull_number,
|
|
101
|
+
});
|
|
102
|
+
return successResult(data);
|
|
58
103
|
},
|
|
59
|
-
required: ['owner', 'repo', 'title', 'head', 'base'],
|
|
60
104
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
105
|
+
// create - Create a pull request
|
|
106
|
+
{
|
|
107
|
+
definition: {
|
|
108
|
+
name: 'github_pulls_create',
|
|
109
|
+
description: 'Create a new pull request',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
owner: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
description: 'Repository owner',
|
|
116
|
+
},
|
|
117
|
+
repo: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'Repository name',
|
|
120
|
+
},
|
|
121
|
+
title: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'PR title',
|
|
124
|
+
},
|
|
125
|
+
head: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'Branch containing changes (or user:branch for cross-repo)',
|
|
128
|
+
},
|
|
129
|
+
base: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'Branch to merge into',
|
|
132
|
+
},
|
|
133
|
+
body: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'PR description',
|
|
136
|
+
},
|
|
137
|
+
draft: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
enum: ['true', 'false'],
|
|
140
|
+
description: 'Create as draft PR',
|
|
141
|
+
},
|
|
142
|
+
maintainer_can_modify: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
enum: ['true', 'false'],
|
|
145
|
+
description: 'Allow maintainer edits',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
required: ['owner', 'repo', 'title', 'head', 'base'],
|
|
76
149
|
},
|
|
77
|
-
base: { type: 'string', description: 'New base branch' },
|
|
78
|
-
maintainer_can_modify: { type: 'boolean' },
|
|
79
150
|
},
|
|
80
|
-
|
|
151
|
+
handler: async (octokit, args) => {
|
|
152
|
+
const { data } = await octokit.pulls.create({
|
|
153
|
+
owner: args.owner,
|
|
154
|
+
repo: args.repo,
|
|
155
|
+
title: args.title,
|
|
156
|
+
head: args.head,
|
|
157
|
+
base: args.base,
|
|
158
|
+
body: args.body,
|
|
159
|
+
draft: args.draft === 'true',
|
|
160
|
+
maintainer_can_modify: args.maintainer_can_modify === 'true',
|
|
161
|
+
});
|
|
162
|
+
return successResult(data);
|
|
163
|
+
},
|
|
81
164
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
165
|
+
// update - Update a pull request
|
|
166
|
+
{
|
|
167
|
+
definition: {
|
|
168
|
+
name: 'github_pulls_update',
|
|
169
|
+
description: 'Update a pull request',
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
properties: {
|
|
173
|
+
owner: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
description: 'Repository owner',
|
|
176
|
+
},
|
|
177
|
+
repo: {
|
|
178
|
+
type: 'string',
|
|
179
|
+
description: 'Repository name',
|
|
180
|
+
},
|
|
181
|
+
pull_number: {
|
|
182
|
+
type: 'number',
|
|
183
|
+
description: 'Pull request number',
|
|
184
|
+
},
|
|
185
|
+
title: {
|
|
186
|
+
type: 'string',
|
|
187
|
+
description: 'PR title',
|
|
188
|
+
},
|
|
189
|
+
body: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
description: 'PR description',
|
|
192
|
+
},
|
|
193
|
+
state: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
enum: ['open', 'closed'],
|
|
196
|
+
description: 'PR state',
|
|
197
|
+
},
|
|
198
|
+
base: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
description: 'Base branch to change to',
|
|
201
|
+
},
|
|
202
|
+
maintainer_can_modify: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
enum: ['true', 'false'],
|
|
205
|
+
description: 'Allow maintainer edits',
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
99
209
|
},
|
|
100
210
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
211
|
+
handler: async (octokit, args) => {
|
|
212
|
+
const { data } = await octokit.pulls.update({
|
|
213
|
+
owner: args.owner,
|
|
214
|
+
repo: args.repo,
|
|
215
|
+
pull_number: args.pull_number,
|
|
216
|
+
title: args.title,
|
|
217
|
+
body: args.body,
|
|
218
|
+
state: args.state,
|
|
219
|
+
base: args.base,
|
|
220
|
+
maintainer_can_modify: args.maintainer_can_modify !== undefined
|
|
221
|
+
? args.maintainer_can_modify === 'true'
|
|
222
|
+
: undefined,
|
|
223
|
+
});
|
|
224
|
+
return successResult(data);
|
|
115
225
|
},
|
|
116
|
-
required: ['owner', 'repo', 'pull_number'],
|
|
117
226
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
227
|
+
// merge - Merge a pull request
|
|
228
|
+
{
|
|
229
|
+
definition: {
|
|
230
|
+
name: 'github_pulls_merge',
|
|
231
|
+
description: 'Merge a pull request',
|
|
232
|
+
inputSchema: {
|
|
233
|
+
type: 'object',
|
|
234
|
+
properties: {
|
|
235
|
+
owner: {
|
|
236
|
+
type: 'string',
|
|
237
|
+
description: 'Repository owner',
|
|
238
|
+
},
|
|
239
|
+
repo: {
|
|
240
|
+
type: 'string',
|
|
241
|
+
description: 'Repository name',
|
|
242
|
+
},
|
|
243
|
+
pull_number: {
|
|
244
|
+
type: 'number',
|
|
245
|
+
description: 'Pull request number',
|
|
246
|
+
},
|
|
247
|
+
commit_title: {
|
|
248
|
+
type: 'string',
|
|
249
|
+
description: 'Title for the merge commit',
|
|
250
|
+
},
|
|
251
|
+
commit_message: {
|
|
252
|
+
type: 'string',
|
|
253
|
+
description: 'Message for the merge commit',
|
|
254
|
+
},
|
|
255
|
+
merge_method: {
|
|
256
|
+
type: 'string',
|
|
257
|
+
enum: ['merge', 'squash', 'rebase'],
|
|
258
|
+
description: 'Merge method to use',
|
|
259
|
+
},
|
|
260
|
+
sha: {
|
|
261
|
+
type: 'string',
|
|
262
|
+
description: 'SHA that head must match to merge',
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
266
|
+
},
|
|
130
267
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
pull_number: { type: 'number', description: 'Pull request number' },
|
|
143
|
-
per_page: { type: 'number' },
|
|
144
|
-
page: { type: 'number' },
|
|
268
|
+
handler: async (octokit, args) => {
|
|
269
|
+
const { data } = await octokit.pulls.merge({
|
|
270
|
+
owner: args.owner,
|
|
271
|
+
repo: args.repo,
|
|
272
|
+
pull_number: args.pull_number,
|
|
273
|
+
commit_title: args.commit_title,
|
|
274
|
+
commit_message: args.commit_message,
|
|
275
|
+
merge_method: args.merge_method,
|
|
276
|
+
sha: args.sha,
|
|
277
|
+
});
|
|
278
|
+
return successResult(data);
|
|
145
279
|
},
|
|
146
|
-
required: ['owner', 'repo', 'pull_number'],
|
|
147
280
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
281
|
+
// list_commits - List commits on a pull request
|
|
282
|
+
{
|
|
283
|
+
definition: {
|
|
284
|
+
name: 'github_pulls_list_commits',
|
|
285
|
+
description: 'List commits on a pull request',
|
|
286
|
+
inputSchema: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
owner: {
|
|
290
|
+
type: 'string',
|
|
291
|
+
description: 'Repository owner',
|
|
292
|
+
},
|
|
293
|
+
repo: {
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: 'Repository name',
|
|
296
|
+
},
|
|
297
|
+
pull_number: {
|
|
298
|
+
type: 'number',
|
|
299
|
+
description: 'Pull request number',
|
|
300
|
+
},
|
|
301
|
+
per_page: {
|
|
302
|
+
type: 'number',
|
|
303
|
+
description: 'Results per page (max 100)',
|
|
304
|
+
},
|
|
305
|
+
page: {
|
|
306
|
+
type: 'number',
|
|
307
|
+
description: 'Page number',
|
|
308
|
+
},
|
|
176
309
|
},
|
|
310
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
177
311
|
},
|
|
178
312
|
},
|
|
179
|
-
|
|
313
|
+
handler: async (octokit, args) => {
|
|
314
|
+
const { data } = await octokit.pulls.listCommits({
|
|
315
|
+
owner: args.owner,
|
|
316
|
+
repo: args.repo,
|
|
317
|
+
pull_number: args.pull_number,
|
|
318
|
+
per_page: args.per_page,
|
|
319
|
+
page: args.page,
|
|
320
|
+
});
|
|
321
|
+
return successResult(data);
|
|
322
|
+
},
|
|
180
323
|
},
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
324
|
+
// list_files - List files changed in a pull request
|
|
325
|
+
{
|
|
326
|
+
definition: {
|
|
327
|
+
name: 'github_pulls_list_files',
|
|
328
|
+
description: 'List files changed in a pull request',
|
|
329
|
+
inputSchema: {
|
|
330
|
+
type: 'object',
|
|
331
|
+
properties: {
|
|
332
|
+
owner: {
|
|
333
|
+
type: 'string',
|
|
334
|
+
description: 'Repository owner',
|
|
335
|
+
},
|
|
336
|
+
repo: {
|
|
337
|
+
type: 'string',
|
|
338
|
+
description: 'Repository name',
|
|
339
|
+
},
|
|
340
|
+
pull_number: {
|
|
341
|
+
type: 'number',
|
|
342
|
+
description: 'Pull request number',
|
|
343
|
+
},
|
|
344
|
+
per_page: {
|
|
345
|
+
type: 'number',
|
|
346
|
+
description: 'Results per page (max 100)',
|
|
347
|
+
},
|
|
348
|
+
page: {
|
|
349
|
+
type: 'number',
|
|
350
|
+
description: 'Page number',
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
194
354
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
355
|
+
},
|
|
356
|
+
handler: async (octokit, args) => {
|
|
357
|
+
const { data } = await octokit.pulls.listFiles({
|
|
358
|
+
owner: args.owner,
|
|
359
|
+
repo: args.repo,
|
|
360
|
+
pull_number: args.pull_number,
|
|
361
|
+
per_page: args.per_page,
|
|
362
|
+
page: args.page,
|
|
363
|
+
});
|
|
364
|
+
return successResult(data);
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
// check_merged - Check if a pull request has been merged
|
|
368
|
+
{
|
|
369
|
+
definition: {
|
|
370
|
+
name: 'github_pulls_check_merged',
|
|
371
|
+
description: 'Check if a pull request has been merged',
|
|
372
|
+
inputSchema: {
|
|
373
|
+
type: 'object',
|
|
374
|
+
properties: {
|
|
375
|
+
owner: {
|
|
376
|
+
type: 'string',
|
|
377
|
+
description: 'Repository owner',
|
|
378
|
+
},
|
|
379
|
+
repo: {
|
|
380
|
+
type: 'string',
|
|
381
|
+
description: 'Repository name',
|
|
382
|
+
},
|
|
383
|
+
pull_number: {
|
|
384
|
+
type: 'number',
|
|
385
|
+
description: 'Pull request number',
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
198
389
|
},
|
|
199
|
-
since: { type: 'string', description: 'ISO 8601 date' },
|
|
200
|
-
per_page: { type: 'number' },
|
|
201
|
-
page: { type: 'number' },
|
|
202
390
|
},
|
|
203
|
-
|
|
391
|
+
handler: async (octokit, args) => {
|
|
392
|
+
try {
|
|
393
|
+
await octokit.pulls.checkIfMerged({
|
|
394
|
+
owner: args.owner,
|
|
395
|
+
repo: args.repo,
|
|
396
|
+
pull_number: args.pull_number,
|
|
397
|
+
});
|
|
398
|
+
return successResult({ merged: true });
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
// 404 means not merged
|
|
402
|
+
if (error.status === 404) {
|
|
403
|
+
return successResult({ merged: false });
|
|
404
|
+
}
|
|
405
|
+
throw error;
|
|
406
|
+
}
|
|
407
|
+
},
|
|
204
408
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
409
|
+
// list_reviews - List reviews on a pull request
|
|
410
|
+
{
|
|
411
|
+
definition: {
|
|
412
|
+
name: 'github_pulls_list_reviews',
|
|
413
|
+
description: 'List reviews on a pull request',
|
|
414
|
+
inputSchema: {
|
|
415
|
+
type: 'object',
|
|
416
|
+
properties: {
|
|
417
|
+
owner: {
|
|
418
|
+
type: 'string',
|
|
419
|
+
description: 'Repository owner',
|
|
420
|
+
},
|
|
421
|
+
repo: {
|
|
422
|
+
type: 'string',
|
|
423
|
+
description: 'Repository name',
|
|
424
|
+
},
|
|
425
|
+
pull_number: {
|
|
426
|
+
type: 'number',
|
|
427
|
+
description: 'Pull request number',
|
|
428
|
+
},
|
|
429
|
+
per_page: {
|
|
430
|
+
type: 'number',
|
|
431
|
+
description: 'Results per page (max 100)',
|
|
432
|
+
},
|
|
433
|
+
page: {
|
|
434
|
+
type: 'number',
|
|
435
|
+
description: 'Page number',
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
223
439
|
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
440
|
+
},
|
|
441
|
+
handler: async (octokit, args) => {
|
|
442
|
+
const { data } = await octokit.pulls.listReviews({
|
|
443
|
+
owner: args.owner,
|
|
444
|
+
repo: args.repo,
|
|
445
|
+
pull_number: args.pull_number,
|
|
446
|
+
per_page: args.per_page,
|
|
447
|
+
page: args.page,
|
|
448
|
+
});
|
|
449
|
+
return successResult(data);
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
// get_review - Get a review
|
|
453
|
+
{
|
|
454
|
+
definition: {
|
|
455
|
+
name: 'github_pulls_get_review',
|
|
456
|
+
description: 'Get a review by ID',
|
|
457
|
+
inputSchema: {
|
|
458
|
+
type: 'object',
|
|
459
|
+
properties: {
|
|
460
|
+
owner: {
|
|
461
|
+
type: 'string',
|
|
462
|
+
description: 'Repository owner',
|
|
463
|
+
},
|
|
464
|
+
repo: {
|
|
465
|
+
type: 'string',
|
|
466
|
+
description: 'Repository name',
|
|
467
|
+
},
|
|
468
|
+
pull_number: {
|
|
469
|
+
type: 'number',
|
|
470
|
+
description: 'Pull request number',
|
|
471
|
+
},
|
|
472
|
+
review_id: {
|
|
473
|
+
type: 'number',
|
|
474
|
+
description: 'Review ID',
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
required: ['owner', 'repo', 'pull_number', 'review_id'],
|
|
228
478
|
},
|
|
229
479
|
},
|
|
230
|
-
|
|
480
|
+
handler: async (octokit, args) => {
|
|
481
|
+
const { data } = await octokit.pulls.getReview({
|
|
482
|
+
owner: args.owner,
|
|
483
|
+
repo: args.repo,
|
|
484
|
+
pull_number: args.pull_number,
|
|
485
|
+
review_id: args.review_id,
|
|
486
|
+
});
|
|
487
|
+
return successResult(data);
|
|
488
|
+
},
|
|
231
489
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
490
|
+
// create_review - Create a review
|
|
491
|
+
{
|
|
492
|
+
definition: {
|
|
493
|
+
name: 'github_pulls_create_review',
|
|
494
|
+
description: 'Create a review on a pull request',
|
|
495
|
+
inputSchema: {
|
|
496
|
+
type: 'object',
|
|
497
|
+
properties: {
|
|
498
|
+
owner: {
|
|
499
|
+
type: 'string',
|
|
500
|
+
description: 'Repository owner',
|
|
501
|
+
},
|
|
502
|
+
repo: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
description: 'Repository name',
|
|
505
|
+
},
|
|
506
|
+
pull_number: {
|
|
507
|
+
type: 'number',
|
|
508
|
+
description: 'Pull request number',
|
|
509
|
+
},
|
|
510
|
+
commit_id: {
|
|
511
|
+
type: 'string',
|
|
512
|
+
description: 'SHA of commit to review',
|
|
513
|
+
},
|
|
514
|
+
body: {
|
|
515
|
+
type: 'string',
|
|
516
|
+
description: 'Review body text',
|
|
517
|
+
},
|
|
518
|
+
event: {
|
|
519
|
+
type: 'string',
|
|
520
|
+
enum: ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'],
|
|
521
|
+
description: 'Review action',
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
246
525
|
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
526
|
+
},
|
|
527
|
+
handler: async (octokit, args) => {
|
|
528
|
+
const { data } = await octokit.pulls.createReview({
|
|
529
|
+
owner: args.owner,
|
|
530
|
+
repo: args.repo,
|
|
531
|
+
pull_number: args.pull_number,
|
|
532
|
+
commit_id: args.commit_id,
|
|
533
|
+
body: args.body,
|
|
534
|
+
event: args.event,
|
|
535
|
+
});
|
|
536
|
+
return successResult(data);
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
// submit_review - Submit a pending review
|
|
540
|
+
{
|
|
541
|
+
definition: {
|
|
542
|
+
name: 'github_pulls_submit_review',
|
|
543
|
+
description: 'Submit a pending review',
|
|
544
|
+
inputSchema: {
|
|
545
|
+
type: 'object',
|
|
546
|
+
properties: {
|
|
547
|
+
owner: {
|
|
548
|
+
type: 'string',
|
|
549
|
+
description: 'Repository owner',
|
|
550
|
+
},
|
|
551
|
+
repo: {
|
|
552
|
+
type: 'string',
|
|
553
|
+
description: 'Repository name',
|
|
554
|
+
},
|
|
555
|
+
pull_number: {
|
|
556
|
+
type: 'number',
|
|
557
|
+
description: 'Pull request number',
|
|
558
|
+
},
|
|
559
|
+
review_id: {
|
|
560
|
+
type: 'number',
|
|
561
|
+
description: 'Review ID',
|
|
562
|
+
},
|
|
563
|
+
body: {
|
|
564
|
+
type: 'string',
|
|
565
|
+
description: 'Review body text',
|
|
566
|
+
},
|
|
567
|
+
event: {
|
|
568
|
+
type: 'string',
|
|
569
|
+
enum: ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'],
|
|
570
|
+
description: 'Review action',
|
|
571
|
+
},
|
|
572
|
+
},
|
|
573
|
+
required: ['owner', 'repo', 'pull_number', 'review_id', 'event'],
|
|
251
574
|
},
|
|
252
575
|
},
|
|
253
|
-
|
|
576
|
+
handler: async (octokit, args) => {
|
|
577
|
+
const { data } = await octokit.pulls.submitReview({
|
|
578
|
+
owner: args.owner,
|
|
579
|
+
repo: args.repo,
|
|
580
|
+
pull_number: args.pull_number,
|
|
581
|
+
review_id: args.review_id,
|
|
582
|
+
body: args.body,
|
|
583
|
+
event: args.event,
|
|
584
|
+
});
|
|
585
|
+
return successResult(data);
|
|
586
|
+
},
|
|
254
587
|
},
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
588
|
+
// list_review_comments - List review comments on a pull request
|
|
589
|
+
{
|
|
590
|
+
definition: {
|
|
591
|
+
name: 'github_pulls_list_review_comments',
|
|
592
|
+
description: 'List review comments on a pull request',
|
|
593
|
+
inputSchema: {
|
|
594
|
+
type: 'object',
|
|
595
|
+
properties: {
|
|
596
|
+
owner: {
|
|
597
|
+
type: 'string',
|
|
598
|
+
description: 'Repository owner',
|
|
599
|
+
},
|
|
600
|
+
repo: {
|
|
601
|
+
type: 'string',
|
|
602
|
+
description: 'Repository name',
|
|
603
|
+
},
|
|
604
|
+
pull_number: {
|
|
605
|
+
type: 'number',
|
|
606
|
+
description: 'Pull request number',
|
|
607
|
+
},
|
|
608
|
+
sort: {
|
|
609
|
+
type: 'string',
|
|
610
|
+
enum: ['created', 'updated'],
|
|
611
|
+
description: 'Sort field',
|
|
612
|
+
},
|
|
613
|
+
direction: {
|
|
614
|
+
type: 'string',
|
|
615
|
+
enum: ['asc', 'desc'],
|
|
616
|
+
description: 'Sort direction',
|
|
617
|
+
},
|
|
618
|
+
per_page: {
|
|
619
|
+
type: 'number',
|
|
620
|
+
description: 'Results per page (max 100)',
|
|
621
|
+
},
|
|
622
|
+
page: {
|
|
623
|
+
type: 'number',
|
|
624
|
+
description: 'Page number',
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
628
|
+
},
|
|
629
|
+
},
|
|
630
|
+
handler: async (octokit, args) => {
|
|
631
|
+
const { data } = await octokit.pulls.listReviewComments({
|
|
632
|
+
owner: args.owner,
|
|
633
|
+
repo: args.repo,
|
|
634
|
+
pull_number: args.pull_number,
|
|
635
|
+
sort: args.sort,
|
|
636
|
+
direction: args.direction,
|
|
637
|
+
per_page: args.per_page,
|
|
638
|
+
page: args.page,
|
|
639
|
+
});
|
|
640
|
+
return successResult(data);
|
|
265
641
|
},
|
|
266
|
-
required: ['owner', 'repo', 'pull_number'],
|
|
267
642
|
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
643
|
+
// create_review_comment - Create a review comment
|
|
644
|
+
{
|
|
645
|
+
definition: {
|
|
646
|
+
name: 'github_pulls_create_review_comment',
|
|
647
|
+
description: 'Create a review comment on a pull request',
|
|
648
|
+
inputSchema: {
|
|
649
|
+
type: 'object',
|
|
650
|
+
properties: {
|
|
651
|
+
owner: {
|
|
652
|
+
type: 'string',
|
|
653
|
+
description: 'Repository owner',
|
|
654
|
+
},
|
|
655
|
+
repo: {
|
|
656
|
+
type: 'string',
|
|
657
|
+
description: 'Repository name',
|
|
658
|
+
},
|
|
659
|
+
pull_number: {
|
|
660
|
+
type: 'number',
|
|
661
|
+
description: 'Pull request number',
|
|
662
|
+
},
|
|
663
|
+
body: {
|
|
664
|
+
type: 'string',
|
|
665
|
+
description: 'Comment body',
|
|
666
|
+
},
|
|
667
|
+
commit_id: {
|
|
668
|
+
type: 'string',
|
|
669
|
+
description: 'SHA of the commit to comment on',
|
|
670
|
+
},
|
|
671
|
+
path: {
|
|
672
|
+
type: 'string',
|
|
673
|
+
description: 'Relative path of the file to comment on',
|
|
674
|
+
},
|
|
675
|
+
line: {
|
|
676
|
+
type: 'number',
|
|
677
|
+
description: 'Line number in the file to comment on',
|
|
678
|
+
},
|
|
679
|
+
side: {
|
|
680
|
+
type: 'string',
|
|
681
|
+
enum: ['LEFT', 'RIGHT'],
|
|
682
|
+
description: 'Side of the diff to comment on',
|
|
683
|
+
},
|
|
684
|
+
in_reply_to: {
|
|
685
|
+
type: 'number',
|
|
686
|
+
description: 'Comment ID to reply to',
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
required: ['owner', 'repo', 'pull_number', 'body', 'commit_id', 'path'],
|
|
690
|
+
},
|
|
691
|
+
},
|
|
692
|
+
handler: async (octokit, args) => {
|
|
693
|
+
const { data } = await octokit.pulls.createReviewComment({
|
|
694
|
+
owner: args.owner,
|
|
695
|
+
repo: args.repo,
|
|
696
|
+
pull_number: args.pull_number,
|
|
697
|
+
body: args.body,
|
|
698
|
+
commit_id: args.commit_id,
|
|
699
|
+
path: args.path,
|
|
700
|
+
line: args.line,
|
|
701
|
+
side: args.side,
|
|
702
|
+
in_reply_to: args.in_reply_to,
|
|
703
|
+
});
|
|
704
|
+
return successResult(data);
|
|
278
705
|
},
|
|
279
|
-
required: ['owner', 'repo', 'pull_number'],
|
|
280
706
|
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
707
|
+
// request_reviewers - Request reviewers
|
|
708
|
+
{
|
|
709
|
+
definition: {
|
|
710
|
+
name: 'github_pulls_request_reviewers',
|
|
711
|
+
description: 'Request reviewers for a pull request',
|
|
712
|
+
inputSchema: {
|
|
713
|
+
type: 'object',
|
|
714
|
+
properties: {
|
|
715
|
+
owner: {
|
|
716
|
+
type: 'string',
|
|
717
|
+
description: 'Repository owner',
|
|
718
|
+
},
|
|
719
|
+
repo: {
|
|
720
|
+
type: 'string',
|
|
721
|
+
description: 'Repository name',
|
|
722
|
+
},
|
|
723
|
+
pull_number: {
|
|
724
|
+
type: 'number',
|
|
725
|
+
description: 'Pull request number',
|
|
726
|
+
},
|
|
727
|
+
reviewers: {
|
|
728
|
+
type: 'array',
|
|
729
|
+
items: { type: 'string' },
|
|
730
|
+
description: 'Usernames to request review from',
|
|
731
|
+
},
|
|
732
|
+
team_reviewers: {
|
|
733
|
+
type: 'array',
|
|
734
|
+
items: { type: 'string' },
|
|
735
|
+
description: 'Team slugs to request review from',
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
required: ['owner', 'repo', 'pull_number'],
|
|
739
|
+
},
|
|
740
|
+
},
|
|
741
|
+
handler: async (octokit, args) => {
|
|
742
|
+
const { data } = await octokit.pulls.requestReviewers({
|
|
743
|
+
owner: args.owner,
|
|
744
|
+
repo: args.repo,
|
|
745
|
+
pull_number: args.pull_number,
|
|
746
|
+
reviewers: args.reviewers,
|
|
747
|
+
team_reviewers: args.team_reviewers,
|
|
748
|
+
});
|
|
749
|
+
return successResult(data);
|
|
292
750
|
},
|
|
293
|
-
required: ['owner', 'repo', 'pull_number'],
|
|
294
751
|
},
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
export async function handlePullsTool(octokit, args) {
|
|
298
|
-
const owner = args.owner;
|
|
299
|
-
const repo = args.repo;
|
|
300
|
-
const pullNumber = args.pull_number;
|
|
301
|
-
// List pull requests
|
|
302
|
-
if (!pullNumber && !('title' in args)) {
|
|
303
|
-
const { data } = await octokit.pulls.list(args);
|
|
304
|
-
return data;
|
|
305
|
-
}
|
|
306
|
-
// Create pull request
|
|
307
|
-
if ('title' in args && 'head' in args && 'base' in args && !pullNumber) {
|
|
308
|
-
const { data } = await octokit.pulls.create(args);
|
|
309
|
-
return data;
|
|
310
|
-
}
|
|
311
|
-
// Get pull request
|
|
312
|
-
if (pullNumber && !('title' in args) && !('body' in args) && !('merge_method' in args) && !('event' in args) && !('reviewers' in args) && !('expected_head_sha' in args) && !('path' in args) && !('commit_id' in args)) {
|
|
313
|
-
// Could be get, listFiles, listCommits, listReviews, listReviewComments, listRequestedReviewers, checkMerged
|
|
314
|
-
if ('sort' in args || 'since' in args) {
|
|
315
|
-
const { data } = await octokit.pulls.listReviewComments(args);
|
|
316
|
-
return data;
|
|
317
|
-
}
|
|
318
|
-
const { data } = await octokit.pulls.get(args);
|
|
319
|
-
return data;
|
|
320
|
-
}
|
|
321
|
-
// Update pull request
|
|
322
|
-
if (pullNumber && ('title' in args || ('body' in args && !('event' in args) && !('path' in args)) || 'state' in args)) {
|
|
323
|
-
const { data } = await octokit.pulls.update(args);
|
|
324
|
-
return data;
|
|
325
|
-
}
|
|
326
|
-
// Merge pull request
|
|
327
|
-
if (pullNumber && 'merge_method' in args) {
|
|
328
|
-
const { data } = await octokit.pulls.merge(args);
|
|
329
|
-
return data;
|
|
330
|
-
}
|
|
331
|
-
// List files
|
|
332
|
-
if (pullNumber && Object.keys(args).filter(k => !['owner', 'repo', 'pull_number', 'per_page', 'page'].includes(k)).length === 0) {
|
|
333
|
-
const { data } = await octokit.pulls.listFiles(args);
|
|
334
|
-
return data;
|
|
335
|
-
}
|
|
336
|
-
// Create review
|
|
337
|
-
if (pullNumber && 'event' in args) {
|
|
338
|
-
const { data } = await octokit.pulls.createReview(args);
|
|
339
|
-
return data;
|
|
340
|
-
}
|
|
341
|
-
// Create review comment
|
|
342
|
-
if (pullNumber && 'body' in args && 'path' in args && 'commit_id' in args) {
|
|
343
|
-
const { data } = await octokit.pulls.createReviewComment(args);
|
|
344
|
-
return data;
|
|
345
|
-
}
|
|
346
|
-
// Request reviewers
|
|
347
|
-
if (pullNumber && ('reviewers' in args || 'team_reviewers' in args)) {
|
|
348
|
-
const { data } = await octokit.pulls.requestReviewers(args);
|
|
349
|
-
return data;
|
|
350
|
-
}
|
|
351
|
-
// Update branch
|
|
352
|
-
if (pullNumber && 'expected_head_sha' in args) {
|
|
353
|
-
const { data } = await octokit.pulls.updateBranch(args);
|
|
354
|
-
return data;
|
|
355
|
-
}
|
|
356
|
-
// Check merged
|
|
357
|
-
if (pullNumber) {
|
|
358
|
-
try {
|
|
359
|
-
await octokit.pulls.checkIfMerged({ owner, repo, pull_number: pullNumber });
|
|
360
|
-
return { merged: true };
|
|
361
|
-
}
|
|
362
|
-
catch {
|
|
363
|
-
return { merged: false };
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// Default: list
|
|
367
|
-
const { data } = await octokit.pulls.list({ owner, repo });
|
|
368
|
-
return data;
|
|
369
|
-
}
|
|
370
|
-
//# sourceMappingURL=pulls.js.map
|
|
752
|
+
],
|
|
753
|
+
};
|