@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,392 +1,870 @@
1
- export const reposTools = [
2
- {
3
- name: 'github_repos_list',
4
- description: 'List repositories for the authenticated user',
5
- inputSchema: {
6
- type: 'object',
7
- properties: {
8
- visibility: {
9
- type: 'string',
10
- enum: ['all', 'public', 'private'],
11
- description: 'Filter by visibility',
12
- },
13
- affiliation: {
14
- type: 'string',
15
- description: 'Comma-separated list: owner, collaborator, organization_member',
16
- },
17
- sort: {
18
- type: 'string',
19
- enum: ['created', 'updated', 'pushed', 'full_name'],
20
- description: 'Sort field',
21
- },
22
- per_page: {
23
- type: 'number',
24
- description: 'Results per page (max 100)',
25
- },
26
- page: {
27
- type: 'number',
28
- description: 'Page number',
1
+ import { successResult } from '../types.js';
2
+ export const reposCategory = {
3
+ name: 'repos',
4
+ description: 'Repository management tools',
5
+ tools: [
6
+ // list - List repositories for authenticated user
7
+ {
8
+ definition: {
9
+ name: 'github_repos_list',
10
+ description: 'List repositories for the authenticated user',
11
+ inputSchema: {
12
+ type: 'object',
13
+ properties: {
14
+ visibility: {
15
+ type: 'string',
16
+ enum: ['all', 'public', 'private'],
17
+ description: 'Filter by visibility',
18
+ },
19
+ sort: {
20
+ type: 'string',
21
+ enum: ['created', 'updated', 'pushed', 'full_name'],
22
+ description: 'Sort field',
23
+ },
24
+ per_page: {
25
+ type: 'number',
26
+ description: 'Results per page (max 100)',
27
+ },
28
+ page: {
29
+ type: 'number',
30
+ description: 'Page number',
31
+ },
32
+ },
29
33
  },
30
34
  },
35
+ handler: async (octokit, args) => {
36
+ const { data } = await octokit.repos.listForAuthenticatedUser({
37
+ visibility: args.visibility,
38
+ sort: args.sort,
39
+ per_page: args.per_page,
40
+ page: args.page,
41
+ });
42
+ return successResult(data);
43
+ },
31
44
  },
32
- },
33
- {
34
- name: 'github_repos_get',
35
- description: 'Get a repository by owner and repo name',
36
- inputSchema: {
37
- type: 'object',
38
- properties: {
39
- owner: { type: 'string', description: 'Repository owner' },
40
- repo: { type: 'string', description: 'Repository name' },
41
- },
42
- required: ['owner', 'repo'],
43
- },
44
- },
45
- {
46
- name: 'github_repos_create',
47
- description: 'Create a new repository for the authenticated user',
48
- inputSchema: {
49
- type: 'object',
50
- properties: {
51
- name: { type: 'string', description: 'Repository name' },
52
- description: { type: 'string', description: 'Repository description' },
53
- private: { type: 'boolean', description: 'Whether the repo is private' },
54
- auto_init: { type: 'boolean', description: 'Initialize with README' },
55
- gitignore_template: { type: 'string', description: 'Gitignore template name' },
56
- license_template: { type: 'string', description: 'License template name' },
57
- },
58
- required: ['name'],
45
+ // list_for_org - List repositories for an organization
46
+ {
47
+ definition: {
48
+ name: 'github_repos_list_for_org',
49
+ description: 'List repositories for an organization',
50
+ inputSchema: {
51
+ type: 'object',
52
+ properties: {
53
+ org: {
54
+ type: 'string',
55
+ description: 'Organization name',
56
+ },
57
+ type: {
58
+ type: 'string',
59
+ enum: ['all', 'public', 'private', 'forks', 'sources', 'member'],
60
+ description: 'Filter by type',
61
+ },
62
+ sort: {
63
+ type: 'string',
64
+ enum: ['created', 'updated', 'pushed', 'full_name'],
65
+ description: 'Sort field',
66
+ },
67
+ per_page: {
68
+ type: 'number',
69
+ description: 'Results per page (max 100)',
70
+ },
71
+ page: {
72
+ type: 'number',
73
+ description: 'Page number',
74
+ },
75
+ },
76
+ required: ['org'],
77
+ },
78
+ },
79
+ handler: async (octokit, args) => {
80
+ const { data } = await octokit.repos.listForOrg({
81
+ org: args.org,
82
+ type: args.type,
83
+ sort: args.sort,
84
+ per_page: args.per_page,
85
+ page: args.page,
86
+ });
87
+ return successResult(data);
88
+ },
59
89
  },
60
- },
61
- {
62
- name: 'github_repos_delete',
63
- description: 'Delete a repository (requires admin access)',
64
- inputSchema: {
65
- type: 'object',
66
- properties: {
67
- owner: { type: 'string', description: 'Repository owner' },
68
- repo: { type: 'string', description: 'Repository name' },
69
- },
70
- required: ['owner', 'repo'],
90
+ // list_for_user - List repositories for a user
91
+ {
92
+ definition: {
93
+ name: 'github_repos_list_for_user',
94
+ description: 'List public repositories for a user',
95
+ inputSchema: {
96
+ type: 'object',
97
+ properties: {
98
+ username: {
99
+ type: 'string',
100
+ description: 'GitHub username',
101
+ },
102
+ type: {
103
+ type: 'string',
104
+ enum: ['all', 'owner', 'member'],
105
+ description: 'Filter by type',
106
+ },
107
+ sort: {
108
+ type: 'string',
109
+ enum: ['created', 'updated', 'pushed', 'full_name'],
110
+ description: 'Sort field',
111
+ },
112
+ per_page: {
113
+ type: 'number',
114
+ description: 'Results per page (max 100)',
115
+ },
116
+ page: {
117
+ type: 'number',
118
+ description: 'Page number',
119
+ },
120
+ },
121
+ required: ['username'],
122
+ },
123
+ },
124
+ handler: async (octokit, args) => {
125
+ const { data } = await octokit.repos.listForUser({
126
+ username: args.username,
127
+ type: args.type,
128
+ sort: args.sort,
129
+ per_page: args.per_page,
130
+ page: args.page,
131
+ });
132
+ return successResult(data);
133
+ },
71
134
  },
72
- },
73
- {
74
- name: 'github_repos_listForUser',
75
- description: 'List public repositories for a user',
76
- inputSchema: {
77
- type: 'object',
78
- properties: {
79
- username: { type: 'string', description: 'GitHub username' },
80
- type: {
81
- type: 'string',
82
- enum: ['all', 'owner', 'member'],
83
- description: 'Type of repos to list',
135
+ // get - Get a repository
136
+ {
137
+ definition: {
138
+ name: 'github_repos_get',
139
+ description: 'Get a repository by owner and name',
140
+ inputSchema: {
141
+ type: 'object',
142
+ properties: {
143
+ owner: {
144
+ type: 'string',
145
+ description: 'Repository owner',
146
+ },
147
+ repo: {
148
+ type: 'string',
149
+ description: 'Repository name',
150
+ },
151
+ },
152
+ required: ['owner', 'repo'],
84
153
  },
85
- sort: {
86
- type: 'string',
87
- enum: ['created', 'updated', 'pushed', 'full_name'],
154
+ },
155
+ handler: async (octokit, args) => {
156
+ const { data } = await octokit.repos.get({
157
+ owner: args.owner,
158
+ repo: args.repo,
159
+ });
160
+ return successResult(data);
161
+ },
162
+ },
163
+ // create - Create a repository for authenticated user
164
+ {
165
+ definition: {
166
+ name: 'github_repos_create',
167
+ description: 'Create a new repository for the authenticated user',
168
+ inputSchema: {
169
+ type: 'object',
170
+ properties: {
171
+ name: {
172
+ type: 'string',
173
+ description: 'Repository name',
174
+ },
175
+ description: {
176
+ type: 'string',
177
+ description: 'Repository description',
178
+ },
179
+ private: {
180
+ type: 'string',
181
+ enum: ['true', 'false'],
182
+ description: 'Whether the repository is private',
183
+ },
184
+ auto_init: {
185
+ type: 'string',
186
+ enum: ['true', 'false'],
187
+ description: 'Create an initial commit with README',
188
+ },
189
+ gitignore_template: {
190
+ type: 'string',
191
+ description: 'Gitignore template to use (e.g., Node, Python)',
192
+ },
193
+ license_template: {
194
+ type: 'string',
195
+ description: 'License template (e.g., mit, apache-2.0)',
196
+ },
197
+ },
198
+ required: ['name'],
88
199
  },
89
- per_page: { type: 'number' },
90
- page: { type: 'number' },
91
200
  },
92
- required: ['username'],
201
+ handler: async (octokit, args) => {
202
+ const { data } = await octokit.repos.createForAuthenticatedUser({
203
+ name: args.name,
204
+ description: args.description,
205
+ private: args.private === 'true',
206
+ auto_init: args.auto_init === 'true',
207
+ gitignore_template: args.gitignore_template,
208
+ license_template: args.license_template,
209
+ });
210
+ return successResult(data);
211
+ },
93
212
  },
94
- },
95
- {
96
- name: 'github_repos_listForOrg',
97
- description: 'List repositories for an organization',
98
- inputSchema: {
99
- type: 'object',
100
- properties: {
101
- org: { type: 'string', description: 'Organization name' },
102
- type: {
103
- type: 'string',
104
- enum: ['all', 'public', 'private', 'forks', 'sources', 'member'],
213
+ // create_in_org - Create a repository in an organization
214
+ {
215
+ definition: {
216
+ name: 'github_repos_create_in_org',
217
+ description: 'Create a new repository in an organization',
218
+ inputSchema: {
219
+ type: 'object',
220
+ properties: {
221
+ org: {
222
+ type: 'string',
223
+ description: 'Organization name',
224
+ },
225
+ name: {
226
+ type: 'string',
227
+ description: 'Repository name',
228
+ },
229
+ description: {
230
+ type: 'string',
231
+ description: 'Repository description',
232
+ },
233
+ private: {
234
+ type: 'string',
235
+ enum: ['true', 'false'],
236
+ description: 'Whether the repository is private',
237
+ },
238
+ auto_init: {
239
+ type: 'string',
240
+ enum: ['true', 'false'],
241
+ description: 'Create an initial commit with README',
242
+ },
243
+ },
244
+ required: ['org', 'name'],
105
245
  },
106
- sort: {
107
- type: 'string',
108
- enum: ['created', 'updated', 'pushed', 'full_name'],
246
+ },
247
+ handler: async (octokit, args) => {
248
+ const { data } = await octokit.repos.createInOrg({
249
+ org: args.org,
250
+ name: args.name,
251
+ description: args.description,
252
+ private: args.private === 'true',
253
+ auto_init: args.auto_init === 'true',
254
+ });
255
+ return successResult(data);
256
+ },
257
+ },
258
+ // update - Update a repository
259
+ {
260
+ definition: {
261
+ name: 'github_repos_update',
262
+ description: 'Update a repository',
263
+ inputSchema: {
264
+ type: 'object',
265
+ properties: {
266
+ owner: {
267
+ type: 'string',
268
+ description: 'Repository owner',
269
+ },
270
+ repo: {
271
+ type: 'string',
272
+ description: 'Repository name',
273
+ },
274
+ name: {
275
+ type: 'string',
276
+ description: 'New repository name',
277
+ },
278
+ description: {
279
+ type: 'string',
280
+ description: 'Repository description',
281
+ },
282
+ private: {
283
+ type: 'string',
284
+ enum: ['true', 'false'],
285
+ description: 'Whether the repository is private',
286
+ },
287
+ default_branch: {
288
+ type: 'string',
289
+ description: 'Default branch name',
290
+ },
291
+ has_issues: {
292
+ type: 'string',
293
+ enum: ['true', 'false'],
294
+ description: 'Enable issues',
295
+ },
296
+ has_wiki: {
297
+ type: 'string',
298
+ enum: ['true', 'false'],
299
+ description: 'Enable wiki',
300
+ },
301
+ },
302
+ required: ['owner', 'repo'],
109
303
  },
110
- per_page: { type: 'number' },
111
- page: { type: 'number' },
112
304
  },
113
- required: ['org'],
305
+ handler: async (octokit, args) => {
306
+ const { data } = await octokit.repos.update({
307
+ owner: args.owner,
308
+ repo: args.repo,
309
+ name: args.name,
310
+ description: args.description,
311
+ private: args.private !== undefined ? args.private === 'true' : undefined,
312
+ default_branch: args.default_branch,
313
+ has_issues: args.has_issues !== undefined ? args.has_issues === 'true' : undefined,
314
+ has_wiki: args.has_wiki !== undefined ? args.has_wiki === 'true' : undefined,
315
+ });
316
+ return successResult(data);
317
+ },
114
318
  },
115
- },
116
- {
117
- name: 'github_repos_fork',
118
- description: 'Fork a repository',
119
- inputSchema: {
120
- type: 'object',
121
- properties: {
122
- owner: { type: 'string', description: 'Repository owner' },
123
- repo: { type: 'string', description: 'Repository name' },
124
- organization: { type: 'string', description: 'Fork to this organization' },
125
- name: { type: 'string', description: 'New name for the fork' },
126
- },
127
- required: ['owner', 'repo'],
319
+ // delete - Delete a repository
320
+ {
321
+ definition: {
322
+ name: 'github_repos_delete',
323
+ description: 'Delete a repository (requires delete_repo scope)',
324
+ inputSchema: {
325
+ type: 'object',
326
+ properties: {
327
+ owner: {
328
+ type: 'string',
329
+ description: 'Repository owner',
330
+ },
331
+ repo: {
332
+ type: 'string',
333
+ description: 'Repository name',
334
+ },
335
+ },
336
+ required: ['owner', 'repo'],
337
+ },
338
+ },
339
+ handler: async (octokit, args) => {
340
+ await octokit.repos.delete({
341
+ owner: args.owner,
342
+ repo: args.repo,
343
+ });
344
+ return successResult({ success: true, message: 'Repository deleted' });
345
+ },
128
346
  },
129
- },
130
- {
131
- name: 'github_repos_listBranches',
132
- description: 'List branches for a repository',
133
- inputSchema: {
134
- type: 'object',
135
- properties: {
136
- owner: { type: 'string', description: 'Repository owner' },
137
- repo: { type: 'string', description: 'Repository name' },
138
- protected: { type: 'boolean', description: 'Only protected branches' },
139
- per_page: { type: 'number' },
140
- page: { type: 'number' },
141
- },
142
- required: ['owner', 'repo'],
347
+ // list_branches - List branches
348
+ {
349
+ definition: {
350
+ name: 'github_repos_list_branches',
351
+ description: 'List branches for a repository',
352
+ inputSchema: {
353
+ type: 'object',
354
+ properties: {
355
+ owner: {
356
+ type: 'string',
357
+ description: 'Repository owner',
358
+ },
359
+ repo: {
360
+ type: 'string',
361
+ description: 'Repository name',
362
+ },
363
+ protected: {
364
+ type: 'string',
365
+ enum: ['true', 'false'],
366
+ description: 'Filter by protected status',
367
+ },
368
+ per_page: {
369
+ type: 'number',
370
+ description: 'Results per page (max 100)',
371
+ },
372
+ page: {
373
+ type: 'number',
374
+ description: 'Page number',
375
+ },
376
+ },
377
+ required: ['owner', 'repo'],
378
+ },
379
+ },
380
+ handler: async (octokit, args) => {
381
+ const { data } = await octokit.repos.listBranches({
382
+ owner: args.owner,
383
+ repo: args.repo,
384
+ protected: args.protected !== undefined ? args.protected === 'true' : undefined,
385
+ per_page: args.per_page,
386
+ page: args.page,
387
+ });
388
+ return successResult(data);
389
+ },
143
390
  },
144
- },
145
- {
146
- name: 'github_repos_getBranch',
147
- description: 'Get a specific branch',
148
- inputSchema: {
149
- type: 'object',
150
- properties: {
151
- owner: { type: 'string', description: 'Repository owner' },
152
- repo: { type: 'string', description: 'Repository name' },
153
- branch: { type: 'string', description: 'Branch name' },
154
- },
155
- required: ['owner', 'repo', 'branch'],
391
+ // get_branch - Get a branch
392
+ {
393
+ definition: {
394
+ name: 'github_repos_get_branch',
395
+ description: 'Get a branch by name',
396
+ inputSchema: {
397
+ type: 'object',
398
+ properties: {
399
+ owner: {
400
+ type: 'string',
401
+ description: 'Repository owner',
402
+ },
403
+ repo: {
404
+ type: 'string',
405
+ description: 'Repository name',
406
+ },
407
+ branch: {
408
+ type: 'string',
409
+ description: 'Branch name',
410
+ },
411
+ },
412
+ required: ['owner', 'repo', 'branch'],
413
+ },
414
+ },
415
+ handler: async (octokit, args) => {
416
+ const { data } = await octokit.repos.getBranch({
417
+ owner: args.owner,
418
+ repo: args.repo,
419
+ branch: args.branch,
420
+ });
421
+ return successResult(data);
422
+ },
156
423
  },
157
- },
158
- {
159
- name: 'github_repos_getContent',
160
- description: 'Get repository content (files or directories)',
161
- inputSchema: {
162
- type: 'object',
163
- properties: {
164
- owner: { type: 'string', description: 'Repository owner' },
165
- repo: { type: 'string', description: 'Repository name' },
166
- path: { type: 'string', description: 'Path to file or directory' },
167
- ref: { type: 'string', description: 'Branch, tag, or commit SHA' },
168
- },
169
- required: ['owner', 'repo', 'path'],
424
+ // list_commits - List commits
425
+ {
426
+ definition: {
427
+ name: 'github_repos_list_commits',
428
+ description: 'List commits for a repository',
429
+ inputSchema: {
430
+ type: 'object',
431
+ properties: {
432
+ owner: {
433
+ type: 'string',
434
+ description: 'Repository owner',
435
+ },
436
+ repo: {
437
+ type: 'string',
438
+ description: 'Repository name',
439
+ },
440
+ sha: {
441
+ type: 'string',
442
+ description: 'SHA or branch to start listing commits from',
443
+ },
444
+ path: {
445
+ type: 'string',
446
+ description: 'Only commits containing this file path',
447
+ },
448
+ author: {
449
+ type: 'string',
450
+ description: 'GitHub username or email to filter by',
451
+ },
452
+ per_page: {
453
+ type: 'number',
454
+ description: 'Results per page (max 100)',
455
+ },
456
+ page: {
457
+ type: 'number',
458
+ description: 'Page number',
459
+ },
460
+ },
461
+ required: ['owner', 'repo'],
462
+ },
463
+ },
464
+ handler: async (octokit, args) => {
465
+ const { data } = await octokit.repos.listCommits({
466
+ owner: args.owner,
467
+ repo: args.repo,
468
+ sha: args.sha,
469
+ path: args.path,
470
+ author: args.author,
471
+ per_page: args.per_page,
472
+ page: args.page,
473
+ });
474
+ return successResult(data);
475
+ },
170
476
  },
171
- },
172
- {
173
- name: 'github_repos_createOrUpdateFileContents',
174
- description: 'Create or update a file in a repository',
175
- inputSchema: {
176
- type: 'object',
177
- properties: {
178
- owner: { type: 'string', description: 'Repository owner' },
179
- repo: { type: 'string', description: 'Repository name' },
180
- path: { type: 'string', description: 'Path to file' },
181
- message: { type: 'string', description: 'Commit message' },
182
- content: { type: 'string', description: 'Base64 encoded file content' },
183
- sha: { type: 'string', description: 'SHA of file being replaced (for updates)' },
184
- branch: { type: 'string', description: 'Branch name' },
185
- },
186
- required: ['owner', 'repo', 'path', 'message', 'content'],
477
+ // get_commit - Get a commit
478
+ {
479
+ definition: {
480
+ name: 'github_repos_get_commit',
481
+ description: 'Get a commit by SHA',
482
+ inputSchema: {
483
+ type: 'object',
484
+ properties: {
485
+ owner: {
486
+ type: 'string',
487
+ description: 'Repository owner',
488
+ },
489
+ repo: {
490
+ type: 'string',
491
+ description: 'Repository name',
492
+ },
493
+ ref: {
494
+ type: 'string',
495
+ description: 'Commit SHA, branch name, or tag name',
496
+ },
497
+ },
498
+ required: ['owner', 'repo', 'ref'],
499
+ },
500
+ },
501
+ handler: async (octokit, args) => {
502
+ const { data } = await octokit.repos.getCommit({
503
+ owner: args.owner,
504
+ repo: args.repo,
505
+ ref: args.ref,
506
+ });
507
+ return successResult(data);
508
+ },
187
509
  },
188
- },
189
- {
190
- name: 'github_repos_listCommits',
191
- description: 'List commits for a repository',
192
- inputSchema: {
193
- type: 'object',
194
- properties: {
195
- owner: { type: 'string', description: 'Repository owner' },
196
- repo: { type: 'string', description: 'Repository name' },
197
- sha: { type: 'string', description: 'Branch or commit SHA to start from' },
198
- path: { type: 'string', description: 'Only commits containing this file path' },
199
- author: { type: 'string', description: 'GitHub username or email' },
200
- since: { type: 'string', description: 'ISO 8601 date' },
201
- until: { type: 'string', description: 'ISO 8601 date' },
202
- per_page: { type: 'number' },
203
- page: { type: 'number' },
204
- },
205
- required: ['owner', 'repo'],
510
+ // compare_commits - Compare two commits
511
+ {
512
+ definition: {
513
+ name: 'github_repos_compare_commits',
514
+ description: 'Compare two commits',
515
+ inputSchema: {
516
+ type: 'object',
517
+ properties: {
518
+ owner: {
519
+ type: 'string',
520
+ description: 'Repository owner',
521
+ },
522
+ repo: {
523
+ type: 'string',
524
+ description: 'Repository name',
525
+ },
526
+ base: {
527
+ type: 'string',
528
+ description: 'Base branch/commit SHA',
529
+ },
530
+ head: {
531
+ type: 'string',
532
+ description: 'Head branch/commit SHA',
533
+ },
534
+ per_page: {
535
+ type: 'number',
536
+ description: 'Results per page (max 100)',
537
+ },
538
+ page: {
539
+ type: 'number',
540
+ description: 'Page number',
541
+ },
542
+ },
543
+ required: ['owner', 'repo', 'base', 'head'],
544
+ },
545
+ },
546
+ handler: async (octokit, args) => {
547
+ const { data } = await octokit.repos.compareCommits({
548
+ owner: args.owner,
549
+ repo: args.repo,
550
+ base: args.base,
551
+ head: args.head,
552
+ per_page: args.per_page,
553
+ page: args.page,
554
+ });
555
+ return successResult(data);
556
+ },
206
557
  },
207
- },
208
- {
209
- name: 'github_repos_getCommit',
210
- description: 'Get a specific commit',
211
- inputSchema: {
212
- type: 'object',
213
- properties: {
214
- owner: { type: 'string', description: 'Repository owner' },
215
- repo: { type: 'string', description: 'Repository name' },
216
- ref: { type: 'string', description: 'Commit SHA or branch name' },
217
- },
218
- required: ['owner', 'repo', 'ref'],
558
+ // get_content - Get repository content
559
+ {
560
+ definition: {
561
+ name: 'github_repos_get_content',
562
+ description: 'Get the contents of a file or directory',
563
+ inputSchema: {
564
+ type: 'object',
565
+ properties: {
566
+ owner: {
567
+ type: 'string',
568
+ description: 'Repository owner',
569
+ },
570
+ repo: {
571
+ type: 'string',
572
+ description: 'Repository name',
573
+ },
574
+ path: {
575
+ type: 'string',
576
+ description: 'Path to file or directory',
577
+ },
578
+ ref: {
579
+ type: 'string',
580
+ description: 'Branch, tag, or commit SHA',
581
+ },
582
+ },
583
+ required: ['owner', 'repo', 'path'],
584
+ },
585
+ },
586
+ handler: async (octokit, args) => {
587
+ const { data } = await octokit.repos.getContent({
588
+ owner: args.owner,
589
+ repo: args.repo,
590
+ path: args.path,
591
+ ref: args.ref,
592
+ });
593
+ return successResult(data);
594
+ },
219
595
  },
220
- },
221
- {
222
- name: 'github_repos_compareCommits',
223
- description: 'Compare two commits',
224
- inputSchema: {
225
- type: 'object',
226
- properties: {
227
- owner: { type: 'string', description: 'Repository owner' },
228
- repo: { type: 'string', description: 'Repository name' },
229
- basehead: { type: 'string', description: 'Base and head in format base...head' },
230
- },
231
- required: ['owner', 'repo', 'basehead'],
596
+ // create_or_update_file - Create or update a file
597
+ {
598
+ definition: {
599
+ name: 'github_repos_create_or_update_file',
600
+ description: 'Create or update a file in a repository',
601
+ inputSchema: {
602
+ type: 'object',
603
+ properties: {
604
+ owner: {
605
+ type: 'string',
606
+ description: 'Repository owner',
607
+ },
608
+ repo: {
609
+ type: 'string',
610
+ description: 'Repository name',
611
+ },
612
+ path: {
613
+ type: 'string',
614
+ description: 'Path to the file',
615
+ },
616
+ message: {
617
+ type: 'string',
618
+ description: 'Commit message',
619
+ },
620
+ content: {
621
+ type: 'string',
622
+ description: 'File content (will be base64 encoded)',
623
+ },
624
+ sha: {
625
+ type: 'string',
626
+ description: 'SHA of file being replaced (required for updates)',
627
+ },
628
+ branch: {
629
+ type: 'string',
630
+ description: 'Branch to commit to',
631
+ },
632
+ },
633
+ required: ['owner', 'repo', 'path', 'message', 'content'],
634
+ },
635
+ },
636
+ handler: async (octokit, args) => {
637
+ const content = Buffer.from(args.content).toString('base64');
638
+ const { data } = await octokit.repos.createOrUpdateFileContents({
639
+ owner: args.owner,
640
+ repo: args.repo,
641
+ path: args.path,
642
+ message: args.message,
643
+ content,
644
+ sha: args.sha,
645
+ branch: args.branch,
646
+ });
647
+ return successResult(data);
648
+ },
232
649
  },
233
- },
234
- {
235
- name: 'github_repos_listContributors',
236
- description: 'List repository contributors',
237
- inputSchema: {
238
- type: 'object',
239
- properties: {
240
- owner: { type: 'string', description: 'Repository owner' },
241
- repo: { type: 'string', description: 'Repository name' },
242
- anon: { type: 'string', description: 'Include anonymous contributors' },
243
- per_page: { type: 'number' },
244
- page: { type: 'number' },
245
- },
246
- required: ['owner', 'repo'],
650
+ // delete_file - Delete a file
651
+ {
652
+ definition: {
653
+ name: 'github_repos_delete_file',
654
+ description: 'Delete a file from a repository',
655
+ inputSchema: {
656
+ type: 'object',
657
+ properties: {
658
+ owner: {
659
+ type: 'string',
660
+ description: 'Repository owner',
661
+ },
662
+ repo: {
663
+ type: 'string',
664
+ description: 'Repository name',
665
+ },
666
+ path: {
667
+ type: 'string',
668
+ description: 'Path to the file',
669
+ },
670
+ message: {
671
+ type: 'string',
672
+ description: 'Commit message',
673
+ },
674
+ sha: {
675
+ type: 'string',
676
+ description: 'SHA of the file being deleted',
677
+ },
678
+ branch: {
679
+ type: 'string',
680
+ description: 'Branch to commit to',
681
+ },
682
+ },
683
+ required: ['owner', 'repo', 'path', 'message', 'sha'],
684
+ },
685
+ },
686
+ handler: async (octokit, args) => {
687
+ const { data } = await octokit.repos.deleteFile({
688
+ owner: args.owner,
689
+ repo: args.repo,
690
+ path: args.path,
691
+ message: args.message,
692
+ sha: args.sha,
693
+ branch: args.branch,
694
+ });
695
+ return successResult(data);
696
+ },
247
697
  },
248
- },
249
- {
250
- name: 'github_repos_listTags',
251
- description: 'List repository tags',
252
- inputSchema: {
253
- type: 'object',
254
- properties: {
255
- owner: { type: 'string', description: 'Repository owner' },
256
- repo: { type: 'string', description: 'Repository name' },
257
- per_page: { type: 'number' },
258
- page: { type: 'number' },
259
- },
260
- required: ['owner', 'repo'],
698
+ // list_collaborators - List collaborators
699
+ {
700
+ definition: {
701
+ name: 'github_repos_list_collaborators',
702
+ description: 'List collaborators for a repository',
703
+ inputSchema: {
704
+ type: 'object',
705
+ properties: {
706
+ owner: {
707
+ type: 'string',
708
+ description: 'Repository owner',
709
+ },
710
+ repo: {
711
+ type: 'string',
712
+ description: 'Repository name',
713
+ },
714
+ affiliation: {
715
+ type: 'string',
716
+ enum: ['outside', 'direct', 'all'],
717
+ description: 'Filter by affiliation',
718
+ },
719
+ per_page: {
720
+ type: 'number',
721
+ description: 'Results per page (max 100)',
722
+ },
723
+ page: {
724
+ type: 'number',
725
+ description: 'Page number',
726
+ },
727
+ },
728
+ required: ['owner', 'repo'],
729
+ },
730
+ },
731
+ handler: async (octokit, args) => {
732
+ const { data } = await octokit.repos.listCollaborators({
733
+ owner: args.owner,
734
+ repo: args.repo,
735
+ affiliation: args.affiliation,
736
+ per_page: args.per_page,
737
+ page: args.page,
738
+ });
739
+ return successResult(data);
740
+ },
261
741
  },
262
- },
263
- {
264
- name: 'github_repos_listReleases',
265
- description: 'List repository releases',
266
- inputSchema: {
267
- type: 'object',
268
- properties: {
269
- owner: { type: 'string', description: 'Repository owner' },
270
- repo: { type: 'string', description: 'Repository name' },
271
- per_page: { type: 'number' },
272
- page: { type: 'number' },
273
- },
274
- required: ['owner', 'repo'],
742
+ // add_collaborator - Add a collaborator
743
+ {
744
+ definition: {
745
+ name: 'github_repos_add_collaborator',
746
+ description: 'Add a collaborator to a repository',
747
+ inputSchema: {
748
+ type: 'object',
749
+ properties: {
750
+ owner: {
751
+ type: 'string',
752
+ description: 'Repository owner',
753
+ },
754
+ repo: {
755
+ type: 'string',
756
+ description: 'Repository name',
757
+ },
758
+ username: {
759
+ type: 'string',
760
+ description: 'Username to add',
761
+ },
762
+ permission: {
763
+ type: 'string',
764
+ enum: ['pull', 'push', 'admin', 'maintain', 'triage'],
765
+ description: 'Permission level',
766
+ },
767
+ },
768
+ required: ['owner', 'repo', 'username'],
769
+ },
770
+ },
771
+ handler: async (octokit, args) => {
772
+ const { data } = await octokit.repos.addCollaborator({
773
+ owner: args.owner,
774
+ repo: args.repo,
775
+ username: args.username,
776
+ permission: args.permission,
777
+ });
778
+ return successResult(data || { success: true, message: 'Collaborator added' });
779
+ },
275
780
  },
276
- },
277
- {
278
- name: 'github_repos_getLatestRelease',
279
- description: 'Get the latest release',
280
- inputSchema: {
281
- type: 'object',
282
- properties: {
283
- owner: { type: 'string', description: 'Repository owner' },
284
- repo: { type: 'string', description: 'Repository name' },
285
- },
286
- required: ['owner', 'repo'],
781
+ // list_forks - List forks
782
+ {
783
+ definition: {
784
+ name: 'github_repos_list_forks',
785
+ description: 'List forks of a repository',
786
+ inputSchema: {
787
+ type: 'object',
788
+ properties: {
789
+ owner: {
790
+ type: 'string',
791
+ description: 'Repository owner',
792
+ },
793
+ repo: {
794
+ type: 'string',
795
+ description: 'Repository name',
796
+ },
797
+ sort: {
798
+ type: 'string',
799
+ enum: ['newest', 'oldest', 'stargazers', 'watchers'],
800
+ description: 'Sort field',
801
+ },
802
+ per_page: {
803
+ type: 'number',
804
+ description: 'Results per page (max 100)',
805
+ },
806
+ page: {
807
+ type: 'number',
808
+ description: 'Page number',
809
+ },
810
+ },
811
+ required: ['owner', 'repo'],
812
+ },
813
+ },
814
+ handler: async (octokit, args) => {
815
+ const { data } = await octokit.repos.listForks({
816
+ owner: args.owner,
817
+ repo: args.repo,
818
+ sort: args.sort,
819
+ per_page: args.per_page,
820
+ page: args.page,
821
+ });
822
+ return successResult(data);
823
+ },
287
824
  },
288
- },
289
- {
290
- name: 'github_repos_createRelease',
291
- description: 'Create a release',
292
- inputSchema: {
293
- type: 'object',
294
- properties: {
295
- owner: { type: 'string', description: 'Repository owner' },
296
- repo: { type: 'string', description: 'Repository name' },
297
- tag_name: { type: 'string', description: 'Tag name for release' },
298
- name: { type: 'string', description: 'Release title' },
299
- body: { type: 'string', description: 'Release notes' },
300
- draft: { type: 'boolean', description: 'Create as draft' },
301
- prerelease: { type: 'boolean', description: 'Mark as prerelease' },
302
- target_commitish: { type: 'string', description: 'Branch or commit SHA' },
303
- },
304
- required: ['owner', 'repo', 'tag_name'],
825
+ // create_fork - Create a fork
826
+ {
827
+ definition: {
828
+ name: 'github_repos_create_fork',
829
+ description: 'Create a fork of a repository',
830
+ inputSchema: {
831
+ type: 'object',
832
+ properties: {
833
+ owner: {
834
+ type: 'string',
835
+ description: 'Repository owner',
836
+ },
837
+ repo: {
838
+ type: 'string',
839
+ description: 'Repository name',
840
+ },
841
+ organization: {
842
+ type: 'string',
843
+ description: 'Organization to fork into (optional)',
844
+ },
845
+ name: {
846
+ type: 'string',
847
+ description: 'Name for the forked repository',
848
+ },
849
+ default_branch_only: {
850
+ type: 'string',
851
+ enum: ['true', 'false'],
852
+ description: 'Only fork the default branch',
853
+ },
854
+ },
855
+ required: ['owner', 'repo'],
856
+ },
857
+ },
858
+ handler: async (octokit, args) => {
859
+ const { data } = await octokit.repos.createFork({
860
+ owner: args.owner,
861
+ repo: args.repo,
862
+ organization: args.organization,
863
+ name: args.name,
864
+ default_branch_only: args.default_branch_only === 'true',
865
+ });
866
+ return successResult(data);
867
+ },
305
868
  },
306
- },
307
- ];
308
- export async function handleReposTool(octokit, args) {
309
- // Extract tool name from the call context
310
- // This is a simplified handler - in practice, you'd want to route based on tool name
311
- // For list (authenticated user's repos)
312
- if ('visibility' in args || ('affiliation' in args && !('username' in args) && !('org' in args))) {
313
- const { data } = await octokit.repos.listForAuthenticatedUser(args);
314
- return data;
315
- }
316
- // For listForUser
317
- if ('username' in args && !('owner' in args)) {
318
- const { data } = await octokit.repos.listForUser(args);
319
- return data;
320
- }
321
- // For listForOrg
322
- if ('org' in args && !('owner' in args)) {
323
- const { data } = await octokit.repos.listForOrg(args);
324
- return data;
325
- }
326
- // For get
327
- if ('owner' in args && 'repo' in args && !('name' in args) && !('path' in args) && !('branch' in args) && !('ref' in args) && !('tag_name' in args) && !('basehead' in args)) {
328
- const { data } = await octokit.repos.get(args);
329
- return data;
330
- }
331
- // For create
332
- if ('name' in args && !('owner' in args)) {
333
- const { data } = await octokit.repos.createForAuthenticatedUser(args);
334
- return data;
335
- }
336
- // For fork
337
- if ('owner' in args && 'repo' in args && ('organization' in args || Object.keys(args).length === 2)) {
338
- const { data } = await octokit.repos.createFork(args);
339
- return data;
340
- }
341
- // For branches
342
- if ('owner' in args && 'repo' in args && 'branch' in args) {
343
- const { data } = await octokit.repos.getBranch(args);
344
- return data;
345
- }
346
- if ('owner' in args && 'repo' in args && 'protected' in args) {
347
- const { data } = await octokit.repos.listBranches(args);
348
- return data;
349
- }
350
- // For content
351
- if ('owner' in args && 'repo' in args && 'path' in args && !('message' in args)) {
352
- const { data } = await octokit.repos.getContent(args);
353
- return data;
354
- }
355
- // For create/update file
356
- if ('owner' in args && 'repo' in args && 'path' in args && 'message' in args && 'content' in args) {
357
- const { data } = await octokit.repos.createOrUpdateFileContents(args);
358
- return data;
359
- }
360
- // For commits
361
- if ('owner' in args && 'repo' in args && 'ref' in args && !('basehead' in args)) {
362
- const { data } = await octokit.repos.getCommit(args);
363
- return data;
364
- }
365
- if ('owner' in args && 'repo' in args && 'basehead' in args) {
366
- const { data } = await octokit.repos.compareCommits(args);
367
- return data;
368
- }
369
- if ('owner' in args && 'repo' in args && ('sha' in args || 'author' in args || 'since' in args || 'until' in args)) {
370
- const { data } = await octokit.repos.listCommits(args);
371
- return data;
372
- }
373
- // For contributors
374
- if ('owner' in args && 'repo' in args && 'anon' in args) {
375
- const { data } = await octokit.repos.listContributors(args);
376
- return data;
377
- }
378
- // For releases
379
- if ('owner' in args && 'repo' in args && 'tag_name' in args) {
380
- const { data } = await octokit.repos.createRelease(args);
381
- return data;
382
- }
383
- // For tags
384
- if ('owner' in args && 'repo' in args) {
385
- const { data } = await octokit.repos.listTags(args);
386
- return data;
387
- }
388
- // Default: list for authenticated user
389
- const { data } = await octokit.repos.listForAuthenticatedUser();
390
- return data;
391
- }
392
- //# sourceMappingURL=repos.js.map
869
+ ],
870
+ };