@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.
Files changed (84) hide show
  1. package/dist/index.js +8 -2
  2. package/dist/prompts/activity-summary.d.ts +10 -0
  3. package/dist/prompts/activity-summary.js +154 -0
  4. package/dist/prompts/code-review.d.ts +9 -0
  5. package/dist/prompts/code-review.js +145 -0
  6. package/dist/prompts/issue-triage.d.ts +9 -0
  7. package/dist/prompts/issue-triage.js +202 -0
  8. package/dist/prompts/release-notes.d.ts +9 -0
  9. package/dist/prompts/release-notes.js +236 -0
  10. package/dist/server.d.ts +8 -1
  11. package/dist/server.js +36 -210
  12. package/dist/tools/categories/actions.d.ts +2 -5
  13. package/dist/tools/categories/actions.js +640 -369
  14. package/dist/tools/categories/activity.d.ts +2 -0
  15. package/dist/tools/categories/activity.js +534 -0
  16. package/dist/tools/categories/apps.d.ts +2 -0
  17. package/dist/tools/categories/apps.js +224 -0
  18. package/dist/tools/categories/billing.d.ts +2 -0
  19. package/dist/tools/categories/billing.js +145 -0
  20. package/dist/tools/categories/checks.d.ts +2 -0
  21. package/dist/tools/categories/checks.js +554 -0
  22. package/dist/tools/categories/codeScanning.d.ts +2 -0
  23. package/dist/tools/categories/codeScanning.js +375 -0
  24. package/dist/tools/categories/codeSecurity.d.ts +2 -0
  25. package/dist/tools/categories/codeSecurity.js +463 -0
  26. package/dist/tools/categories/codesOfConduct.d.ts +2 -0
  27. package/dist/tools/categories/codesOfConduct.js +45 -0
  28. package/dist/tools/categories/codespaces.d.ts +2 -0
  29. package/dist/tools/categories/codespaces.js +259 -0
  30. package/dist/tools/categories/copilot.d.ts +2 -0
  31. package/dist/tools/categories/copilot.js +187 -0
  32. package/dist/tools/categories/dependabot.d.ts +2 -0
  33. package/dist/tools/categories/dependabot.js +454 -0
  34. package/dist/tools/categories/emojis.d.ts +2 -0
  35. package/dist/tools/categories/emojis.js +22 -0
  36. package/dist/tools/categories/gists.d.ts +2 -5
  37. package/dist/tools/categories/gists.js +474 -285
  38. package/dist/tools/categories/git.d.ts +2 -0
  39. package/dist/tools/categories/git.js +520 -0
  40. package/dist/tools/categories/gitignore.d.ts +2 -0
  41. package/dist/tools/categories/gitignore.js +45 -0
  42. package/dist/tools/categories/index.d.ts +33 -0
  43. package/dist/tools/categories/index.js +33 -0
  44. package/dist/tools/categories/interactions.d.ts +2 -0
  45. package/dist/tools/categories/interactions.js +184 -0
  46. package/dist/tools/categories/issues.d.ts +2 -5
  47. package/dist/tools/categories/issues.js +692 -390
  48. package/dist/tools/categories/licenses.d.ts +2 -0
  49. package/dist/tools/categories/licenses.js +95 -0
  50. package/dist/tools/categories/markdown.d.ts +2 -0
  51. package/dist/tools/categories/markdown.js +64 -0
  52. package/dist/tools/categories/meta.d.ts +2 -0
  53. package/dist/tools/categories/meta.js +74 -0
  54. package/dist/tools/categories/migrations.d.ts +2 -0
  55. package/dist/tools/categories/migrations.js +290 -0
  56. package/dist/tools/categories/orgs.d.ts +2 -5
  57. package/dist/tools/categories/orgs.js +585 -417
  58. package/dist/tools/categories/packages.d.ts +2 -0
  59. package/dist/tools/categories/packages.js +918 -0
  60. package/dist/tools/categories/projects.d.ts +2 -0
  61. package/dist/tools/categories/projects.js +692 -0
  62. package/dist/tools/categories/pulls.d.ts +2 -5
  63. package/dist/tools/categories/pulls.js +715 -332
  64. package/dist/tools/categories/rateLimit.d.ts +2 -0
  65. package/dist/tools/categories/rateLimit.js +22 -0
  66. package/dist/tools/categories/reactions.d.ts +2 -0
  67. package/dist/tools/categories/reactions.js +385 -0
  68. package/dist/tools/categories/repos.d.ts +2 -5
  69. package/dist/tools/categories/repos.js +844 -366
  70. package/dist/tools/categories/search.d.ts +2 -5
  71. package/dist/tools/categories/search.js +294 -196
  72. package/dist/tools/categories/secretScanning.d.ts +2 -0
  73. package/dist/tools/categories/secretScanning.js +324 -0
  74. package/dist/tools/categories/securityAdvisories.d.ts +2 -0
  75. package/dist/tools/categories/securityAdvisories.js +407 -0
  76. package/dist/tools/categories/teams.d.ts +2 -0
  77. package/dist/tools/categories/teams.js +614 -0
  78. package/dist/tools/categories/users.d.ts +2 -5
  79. package/dist/tools/categories/users.js +474 -247
  80. package/dist/tools/generator.d.ts +35 -15
  81. package/dist/tools/generator.js +113 -57
  82. package/dist/tools/types.d.ts +63 -0
  83. package/dist/tools/types.js +17 -0
  84. package/package.json +1 -1
@@ -1,370 +1,753 @@
1
- export const pullsTools = [
2
- {
3
- name: 'github_pulls_list',
4
- description: 'List pull requests for a repository',
5
- inputSchema: {
6
- type: 'object',
7
- properties: {
8
- owner: { type: 'string', description: 'Repository owner' },
9
- repo: { type: 'string', description: 'Repository name' },
10
- state: {
11
- type: 'string',
12
- enum: ['open', 'closed', 'all'],
13
- description: 'Filter by state',
14
- },
15
- head: { type: 'string', description: 'Filter by head user:ref-name' },
16
- base: { type: 'string', description: 'Filter by base branch' },
17
- sort: {
18
- type: 'string',
19
- enum: ['created', 'updated', 'popularity', 'long-running'],
20
- },
21
- direction: {
22
- type: 'string',
23
- enum: ['asc', 'desc'],
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
- required: ['owner', 'repo'],
29
- },
30
- },
31
- {
32
- name: 'github_pulls_get',
33
- description: 'Get a specific pull request',
34
- inputSchema: {
35
- type: 'object',
36
- properties: {
37
- owner: { type: 'string', description: 'Repository owner' },
38
- repo: { type: 'string', description: 'Repository name' },
39
- pull_number: { type: 'number', description: 'Pull request number' },
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
- name: 'github_pulls_create',
46
- description: 'Create a pull request',
47
- inputSchema: {
48
- type: 'object',
49
- properties: {
50
- owner: { type: 'string', description: 'Repository owner' },
51
- repo: { type: 'string', description: 'Repository name' },
52
- title: { type: 'string', description: 'PR title' },
53
- head: { type: 'string', description: 'Branch containing changes' },
54
- base: { type: 'string', description: 'Branch to merge into' },
55
- body: { type: 'string', description: 'PR description' },
56
- draft: { type: 'boolean', description: 'Create as draft PR' },
57
- maintainer_can_modify: { type: 'boolean', description: 'Allow maintainer edits' },
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
- name: 'github_pulls_update',
64
- description: 'Update a pull request',
65
- inputSchema: {
66
- type: 'object',
67
- properties: {
68
- owner: { type: 'string', description: 'Repository owner' },
69
- repo: { type: 'string', description: 'Repository name' },
70
- pull_number: { type: 'number', description: 'Pull request number' },
71
- title: { type: 'string', description: 'PR title' },
72
- body: { type: 'string', description: 'PR description' },
73
- state: {
74
- type: 'string',
75
- enum: ['open', 'closed'],
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
- required: ['owner', 'repo', 'pull_number'],
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
- name: 'github_pulls_merge',
85
- description: 'Merge a pull request',
86
- inputSchema: {
87
- type: 'object',
88
- properties: {
89
- owner: { type: 'string', description: 'Repository owner' },
90
- repo: { type: 'string', description: 'Repository name' },
91
- pull_number: { type: 'number', description: 'Pull request number' },
92
- commit_title: { type: 'string', description: 'Merge commit title' },
93
- commit_message: { type: 'string', description: 'Merge commit message' },
94
- sha: { type: 'string', description: 'SHA that head must match to merge' },
95
- merge_method: {
96
- type: 'string',
97
- enum: ['merge', 'squash', 'rebase'],
98
- description: 'Merge method to use',
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
- required: ['owner', 'repo', 'pull_number'],
102
- },
103
- },
104
- {
105
- name: 'github_pulls_listFiles',
106
- description: 'List files changed in a pull request',
107
- inputSchema: {
108
- type: 'object',
109
- properties: {
110
- owner: { type: 'string', description: 'Repository owner' },
111
- repo: { type: 'string', description: 'Repository name' },
112
- pull_number: { type: 'number', description: 'Pull request number' },
113
- per_page: { type: 'number' },
114
- page: { type: 'number' },
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
- name: 'github_pulls_listCommits',
121
- description: 'List commits in a pull request',
122
- inputSchema: {
123
- type: 'object',
124
- properties: {
125
- owner: { type: 'string', description: 'Repository owner' },
126
- repo: { type: 'string', description: 'Repository name' },
127
- pull_number: { type: 'number', description: 'Pull request number' },
128
- per_page: { type: 'number' },
129
- page: { type: 'number' },
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
- required: ['owner', 'repo', 'pull_number'],
132
- },
133
- },
134
- {
135
- name: 'github_pulls_listReviews',
136
- description: 'List reviews on a pull request',
137
- inputSchema: {
138
- type: 'object',
139
- properties: {
140
- owner: { type: 'string', description: 'Repository owner' },
141
- repo: { type: 'string', description: 'Repository name' },
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
- name: 'github_pulls_createReview',
151
- description: 'Create a review on a pull request',
152
- inputSchema: {
153
- type: 'object',
154
- properties: {
155
- owner: { type: 'string', description: 'Repository owner' },
156
- repo: { type: 'string', description: 'Repository name' },
157
- pull_number: { type: 'number', description: 'Pull request number' },
158
- commit_id: { type: 'string', description: 'SHA of commit to review' },
159
- body: { type: 'string', description: 'Review comment body' },
160
- event: {
161
- type: 'string',
162
- enum: ['APPROVE', 'REQUEST_CHANGES', 'COMMENT'],
163
- description: 'Review action',
164
- },
165
- comments: {
166
- type: 'array',
167
- description: 'Line comments for the review',
168
- items: {
169
- type: 'object',
170
- properties: {
171
- path: { type: 'string', description: 'File path' },
172
- position: { type: 'number', description: 'Line position in diff' },
173
- body: { type: 'string', description: 'Comment text' },
174
- },
175
- required: ['path', 'body'],
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
- required: ['owner', 'repo', 'pull_number'],
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
- name: 'github_pulls_listReviewComments',
184
- description: 'List review comments on a pull request',
185
- inputSchema: {
186
- type: 'object',
187
- properties: {
188
- owner: { type: 'string', description: 'Repository owner' },
189
- repo: { type: 'string', description: 'Repository name' },
190
- pull_number: { type: 'number', description: 'Pull request number' },
191
- sort: {
192
- type: 'string',
193
- enum: ['created', 'updated'],
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
- direction: {
196
- type: 'string',
197
- enum: ['asc', 'desc'],
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
- required: ['owner', 'repo', 'pull_number'],
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
- name: 'github_pulls_createReviewComment',
208
- description: 'Create a review comment on a pull request',
209
- inputSchema: {
210
- type: 'object',
211
- properties: {
212
- owner: { type: 'string', description: 'Repository owner' },
213
- repo: { type: 'string', description: 'Repository name' },
214
- pull_number: { type: 'number', description: 'Pull request number' },
215
- body: { type: 'string', description: 'Comment text' },
216
- commit_id: { type: 'string', description: 'SHA of commit to comment on' },
217
- path: { type: 'string', description: 'File path' },
218
- line: { type: 'number', description: 'Line number in file' },
219
- side: {
220
- type: 'string',
221
- enum: ['LEFT', 'RIGHT'],
222
- description: 'Side of the diff',
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
- start_line: { type: 'number', description: 'Start line for multi-line comment' },
225
- start_side: {
226
- type: 'string',
227
- enum: ['LEFT', 'RIGHT'],
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
- required: ['owner', 'repo', 'pull_number', 'body', 'commit_id', 'path'],
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
- name: 'github_pulls_requestReviewers',
235
- description: 'Request reviewers for a pull request',
236
- inputSchema: {
237
- type: 'object',
238
- properties: {
239
- owner: { type: 'string', description: 'Repository owner' },
240
- repo: { type: 'string', description: 'Repository name' },
241
- pull_number: { type: 'number', description: 'Pull request number' },
242
- reviewers: {
243
- type: 'array',
244
- items: { type: 'string' },
245
- description: 'Usernames to request review from',
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
- team_reviewers: {
248
- type: 'array',
249
- items: { type: 'string' },
250
- description: 'Team slugs to request review from',
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
- required: ['owner', 'repo', 'pull_number'],
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
- name: 'github_pulls_listRequestedReviewers',
258
- description: 'List requested reviewers for a pull request',
259
- inputSchema: {
260
- type: 'object',
261
- properties: {
262
- owner: { type: 'string', description: 'Repository owner' },
263
- repo: { type: 'string', description: 'Repository name' },
264
- pull_number: { type: 'number', description: 'Pull request number' },
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
- name: 'github_pulls_checkMerged',
271
- description: 'Check if a pull request has been merged',
272
- inputSchema: {
273
- type: 'object',
274
- properties: {
275
- owner: { type: 'string', description: 'Repository owner' },
276
- repo: { type: 'string', description: 'Repository name' },
277
- pull_number: { type: 'number', description: 'Pull request number' },
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
- name: 'github_pulls_updateBranch',
284
- description: 'Update a pull request branch with latest base',
285
- inputSchema: {
286
- type: 'object',
287
- properties: {
288
- owner: { type: 'string', description: 'Repository owner' },
289
- repo: { type: 'string', description: 'Repository name' },
290
- pull_number: { type: 'number', description: 'Pull request number' },
291
- expected_head_sha: { type: 'string', description: 'Expected SHA of head ref' },
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
+ };