feat: add issue management functionalities for github

- Implemented `listIssues`, `updateIssue`, and `addIssueComment` functions to manage GitHub issues.
- Introduced corresponding schemas: `ListIssuesOptionsSchema`, `UpdateIssueOptionsSchema`, and `IssueCommentSchema`.
- Updated server request handlers to support new functionalities.
- Enhanced README with documentation for new features.
This commit is contained in:
Jerad Bitner
2024-11-28 13:59:37 -08:00
parent 6d83c78752
commit 08015830a6
3 changed files with 202 additions and 1 deletions

View File

@@ -358,6 +358,39 @@ export const CreateBranchSchema = RepoParamsSchema.extend({
.describe("Optional: source branch to create from (defaults to the repository's default branch)")
});
// Add these schema definitions for issue management
export const ListIssuesOptionsSchema = z.object({
owner: z.string(),
repo: z.string(),
state: z.enum(['open', 'closed', 'all']).optional(),
labels: z.array(z.string()).optional(),
sort: z.enum(['created', 'updated', 'comments']).optional(),
direction: z.enum(['asc', 'desc']).optional(),
since: z.string().optional(), // ISO 8601 timestamp
page: z.number().optional(),
per_page: z.number().optional()
});
export const UpdateIssueOptionsSchema = z.object({
owner: z.string(),
repo: z.string(),
issue_number: z.number(),
title: z.string().optional(),
body: z.string().optional(),
state: z.enum(['open', 'closed']).optional(),
labels: z.array(z.string()).optional(),
assignees: z.array(z.string()).optional(),
milestone: z.number().optional()
});
export const IssueCommentSchema = z.object({
owner: z.string(),
repo: z.string(),
issue_number: z.number(),
body: z.string()
});
// Export types
export type GitHubAuthor = z.infer<typeof GitHubAuthorSchema>;
export type GitHubFork = z.infer<typeof GitHubForkSchema>;