improve logging
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { type } from "arktype";
|
||||
import { log } from "../utils/cli.ts";
|
||||
import { contextualize, tool } from "./shared.ts";
|
||||
|
||||
export const PullRequest = type({
|
||||
@@ -18,7 +19,7 @@ export const PullRequestTool = tool({
|
||||
encoding: "utf8",
|
||||
}).trim();
|
||||
|
||||
console.log(`Current branch: ${currentBranch}`);
|
||||
log.info(`Current branch: ${currentBranch}`);
|
||||
|
||||
const result = await ctx.octokit.rest.pulls.create({
|
||||
owner: ctx.owner,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ export const PullRequestInfoTool = tool({
|
||||
});
|
||||
|
||||
const data = pr.data;
|
||||
|
||||
|
||||
const baseBranch = data.base.ref;
|
||||
const headBranch = data.head.ref;
|
||||
|
||||
|
||||
+20
-14
@@ -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
|
||||
|
||||
+1
-1
@@ -4,8 +4,8 @@ import { FastMCP } from "fastmcp";
|
||||
import { CommentTool } from "./comment.ts";
|
||||
import { IssueTool } from "./issue.ts";
|
||||
import { PullRequestTool } from "./pr.ts";
|
||||
import { ReviewTool } from "./review.ts";
|
||||
import { PullRequestInfoTool } from "./prInfo.ts";
|
||||
import { ReviewTool } from "./review.ts";
|
||||
import { addTools } from "./shared.ts";
|
||||
|
||||
const server = new FastMCP({
|
||||
|
||||
Reference in New Issue
Block a user