improve logging

This commit is contained in:
David Blass
2025-10-31 01:58:43 -04:00
parent 434458a068
commit 15a7154aea
13 changed files with 132 additions and 142 deletions
+20 -14
View File
@@ -1,26 +1,32 @@
import type { RestEndpointMethodTypes } from "@octokit/rest";
import { type } from "arktype";
import { contextualize, tool } from "./shared.ts";
import type { RestEndpointMethodTypes } from "@octokit/rest";
export const Review = type({
pull_number: type.number.describe("The pull request number to review"),
event: type.enumerated("APPROVE", "REQUEST_CHANGES", "COMMENT").describe("'APPROVE', 'REQUEST_CHANGES', or 'COMMENT' (the review action)"),
body: type.string.describe("The body content for the review (required for REQUEST_CHANGES or COMMENT)").optional(),
commit_id: type.string.describe("Optional SHA of the commit being reviewed. Defaults to latest.").optional(),
comments: type
({
path: type.string.describe("The file path to comment on"),
position: type.number.describe("The diff position in the file"),
body: type.string.describe("The comment text"),
})
.array()
.describe("Array of draft review comments for specific lines, optional.")
.optional()
event: type
.enumerated("APPROVE", "REQUEST_CHANGES", "COMMENT")
.describe("'APPROVE', 'REQUEST_CHANGES', or 'COMMENT' (the review action)"),
body: type.string
.describe("The body content for the review (required for REQUEST_CHANGES or COMMENT)")
.optional(),
commit_id: type.string
.describe("Optional SHA of the commit being reviewed. Defaults to latest.")
.optional(),
comments: type({
path: type.string.describe("The file path to comment on"),
position: type.number.describe("The diff position in the file"),
body: type.string.describe("The comment text"),
})
.array()
.describe("Array of draft review comments for specific lines, optional.")
.optional(),
});
export const ReviewTool = tool({
name: "submit_pull_request_review",
description: "Submit a review (approve, request changes, or comment) for an existing pull request.",
description:
"Submit a review (approve, request changes, or comment) for an existing pull request.",
parameters: Review,
execute: contextualize(async ({ pull_number, event, body, commit_id, comments = [] }, ctx) => {
// Compose the request