0.0.137
This commit is contained in:
@@ -97443,7 +97443,7 @@ function query({
|
|||||||
// package.json
|
// package.json
|
||||||
var package_default = {
|
var package_default = {
|
||||||
name: "@pullfrog/action",
|
name: "@pullfrog/action",
|
||||||
version: "0.0.136",
|
version: "0.0.137",
|
||||||
type: "module",
|
type: "module",
|
||||||
files: [
|
files: [
|
||||||
"index.js",
|
"index.js",
|
||||||
@@ -97972,7 +97972,7 @@ ${disableProgressComment ? "" : `
|
|||||||
prompt: `Follow these steps:
|
prompt: `Follow these steps:
|
||||||
1. Get PR info with ${ghPullfrogMcpName}/get_pull_request (this automatically prepares the repository by fetching and checking out the PR branch)
|
1. Get PR info with ${ghPullfrogMcpName}/get_pull_request (this automatically prepares the repository by fetching and checking out the PR branch)
|
||||||
|
|
||||||
2. View diff: \`git diff origin/<base>...origin/<head>\` (replace <base> and <head> with 'base' and 'head' from PR info)
|
2. **IMPORTANT**: After calling ${ghPullfrogMcpName}/get_pull_request, the PR branch is already checked out locally. View diff using: \`git diff origin/<base>...HEAD\` (replace <base> with 'base' from PR info). Do NOT use \`origin/<head>\` - the branch is checked out locally, not as a remote tracking branch.
|
||||||
|
|
||||||
3. Read files from the checked-out PR branch to understand the implementation. Always use **relative paths** from repo root (e.g., \`src/index.ts\`), never absolute paths.
|
3. Read files from the checked-out PR branch to understand the implementation. Always use **relative paths** from repo root (e.g., \`src/index.ts\`), never absolute paths.
|
||||||
|
|
||||||
@@ -98034,79 +98034,12 @@ ${disableProgressComment ? "" : `
|
|||||||
var modes = getModes({ disableProgressComment: void 0 });
|
var modes = getModes({ disableProgressComment: void 0 });
|
||||||
|
|
||||||
// agents/instructions.ts
|
// agents/instructions.ts
|
||||||
function extractEssentialEventData(event) {
|
|
||||||
const trigger = event.trigger;
|
|
||||||
const essential = { trigger };
|
|
||||||
if ("issue_number" in event) {
|
|
||||||
essential.issue_number = event.issue_number;
|
|
||||||
}
|
|
||||||
if ("branch" in event && event.branch) {
|
|
||||||
essential.branch = event.branch;
|
|
||||||
}
|
|
||||||
switch (trigger) {
|
|
||||||
case "issue_comment_created":
|
|
||||||
if ("comment_id" in event) essential.comment_id = event.comment_id;
|
|
||||||
if ("comment_body" in event) essential.comment_body = event.comment_body;
|
|
||||||
if ("context" in event && event.context && typeof event.context === "object") {
|
|
||||||
const ctx = event.context;
|
|
||||||
if (ctx.issue && typeof ctx.issue === "object") {
|
|
||||||
const issue2 = ctx.issue;
|
|
||||||
if (issue2.title) essential.issue_title = issue2.title;
|
|
||||||
if (issue2.body) essential.issue_body = issue2.body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "issues_opened":
|
|
||||||
case "issues_assigned":
|
|
||||||
case "issues_labeled":
|
|
||||||
if ("issue_title" in event) essential.issue_title = event.issue_title;
|
|
||||||
if ("issue_body" in event) essential.issue_body = event.issue_body;
|
|
||||||
break;
|
|
||||||
case "pull_request_opened":
|
|
||||||
case "pull_request_review_requested":
|
|
||||||
if ("pr_title" in event) essential.pr_title = event.pr_title;
|
|
||||||
if ("pr_body" in event) essential.pr_body = event.pr_body;
|
|
||||||
if ("branch" in event) essential.branch = event.branch;
|
|
||||||
break;
|
|
||||||
case "pull_request_review_submitted":
|
|
||||||
if ("review_id" in event) essential.review_id = event.review_id;
|
|
||||||
if ("review_body" in event) essential.review_body = event.review_body;
|
|
||||||
if ("review_state" in event) essential.review_state = event.review_state;
|
|
||||||
if ("branch" in event) essential.branch = event.branch;
|
|
||||||
break;
|
|
||||||
case "pull_request_review_comment_created":
|
|
||||||
if ("comment_id" in event) essential.comment_id = event.comment_id;
|
|
||||||
if ("comment_body" in event) essential.comment_body = event.comment_body;
|
|
||||||
if ("pr_title" in event) essential.pr_title = event.pr_title;
|
|
||||||
if ("branch" in event) essential.branch = event.branch;
|
|
||||||
break;
|
|
||||||
case "check_suite_completed":
|
|
||||||
if ("pr_title" in event) essential.pr_title = event.pr_title;
|
|
||||||
if ("pr_body" in event) essential.pr_body = event.pr_body;
|
|
||||||
if ("branch" in event) essential.branch = event.branch;
|
|
||||||
if ("check_suite" in event) {
|
|
||||||
essential.check_suite = {
|
|
||||||
id: event.check_suite.id,
|
|
||||||
head_sha: event.check_suite.head_sha,
|
|
||||||
head_branch: event.check_suite.head_branch,
|
|
||||||
status: event.check_suite.status,
|
|
||||||
conclusion: event.check_suite.conclusion
|
|
||||||
};
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "workflow_dispatch":
|
|
||||||
if ("inputs" in event) essential.inputs = event.inputs;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return essential;
|
|
||||||
}
|
|
||||||
var addInstructions = (payload) => {
|
var addInstructions = (payload) => {
|
||||||
let encodedEvent = "";
|
let encodedEvent = "";
|
||||||
const eventKeys = Object.keys(payload.event);
|
const eventKeys = Object.keys(payload.event);
|
||||||
if (eventKeys.length === 1 && eventKeys[0] === "trigger") {
|
if (eventKeys.length === 1 && eventKeys[0] === "trigger") {
|
||||||
} else {
|
} else {
|
||||||
const essentialEvent = extractEssentialEventData(payload.event);
|
encodedEvent = encode(payload.event);
|
||||||
encodedEvent = encode(essentialEvent);
|
|
||||||
}
|
}
|
||||||
return `
|
return `
|
||||||
***********************************************
|
***********************************************
|
||||||
@@ -98177,7 +98110,7 @@ MCP servers provide tools you can call. Inspect your available MCP servers at st
|
|||||||
|
|
||||||
Tool names may be formatted as \`(server name)/(tool name)\`, for example: \`${ghPullfrogMcpName}/create_issue_comment\`
|
Tool names may be formatted as \`(server name)/(tool name)\`, for example: \`${ghPullfrogMcpName}/create_issue_comment\`
|
||||||
|
|
||||||
**GitHub CLI prohibition**: Do not use the \`gh\` CLI under any circumstances. Use the corresponding tool from ${ghPullfrogMcpName} instead.
|
**GitHub CLI**: Prefer using MCP tools from ${ghPullfrogMcpName} for GitHub operations. The \`gh\` CLI is available as a fallback if needed, but MCP tools handle authentication and provide better integration.
|
||||||
|
|
||||||
**Git operations**: All git operations must use ${ghPullfrogMcpName} MCP tools to ensure proper authentication and commit attribution. Do NOT use git commands directly (e.g., \`git commit\`, \`git push\`, \`git checkout\`, \`git branch\`) - these will use incorrect credentials and attribute commits to the wrong author.
|
**Git operations**: All git operations must use ${ghPullfrogMcpName} MCP tools to ensure proper authentication and commit attribution. Do NOT use git commands directly (e.g., \`git commit\`, \`git push\`, \`git checkout\`, \`git branch\`) - these will use incorrect credentials and attribute commits to the wrong author.
|
||||||
|
|
||||||
@@ -124792,7 +124725,7 @@ var PullRequestInfo = type({
|
|||||||
});
|
});
|
||||||
var PullRequestInfoTool = tool({
|
var PullRequestInfoTool = tool({
|
||||||
name: "get_pull_request",
|
name: "get_pull_request",
|
||||||
description: "Retrieve PR information and automatically prepare the repository for review by fetching and checking out the PR branch.",
|
description: "Retrieve PR information. Automatically fetches and checks out the PR branch.",
|
||||||
parameters: PullRequestInfo,
|
parameters: PullRequestInfo,
|
||||||
execute: contextualize(async ({ pull_number }, ctx) => {
|
execute: contextualize(async ({ pull_number }, ctx) => {
|
||||||
const pr = await ctx.octokit.rest.pulls.get({
|
const pr = await ctx.octokit.rest.pulls.get({
|
||||||
@@ -124806,12 +124739,21 @@ var PullRequestInfoTool = tool({
|
|||||||
if (!baseBranch) {
|
if (!baseBranch) {
|
||||||
throw new Error(`Base branch not found for PR #${pull_number}`);
|
throw new Error(`Base branch not found for PR #${pull_number}`);
|
||||||
}
|
}
|
||||||
|
const baseRepo = data.base.repo.full_name;
|
||||||
|
const headRepo = data.head.repo.full_name;
|
||||||
|
const isFork = headRepo !== baseRepo;
|
||||||
|
log.info(`Checking out PR #${pull_number} using gh pr checkout`);
|
||||||
|
$("gh", ["pr", "checkout", pull_number.toString()]);
|
||||||
log.info(`Fetching base branch: origin/${baseBranch}`);
|
log.info(`Fetching base branch: origin/${baseBranch}`);
|
||||||
$("git", ["fetch", "origin", baseBranch, "--depth=20"]);
|
$("git", ["fetch", "origin", baseBranch, "--depth=20"]);
|
||||||
log.info(`Fetching PR #${pull_number} using refs/pull/${pull_number}/head`);
|
const currentBranch = $("git", ["rev-parse", "--abbrev-ref", "HEAD"], { log: false }).trim();
|
||||||
$("git", ["fetch", "origin", `refs/pull/${pull_number}/head`]);
|
const currentSha = $("git", ["rev-parse", "HEAD"], { log: false }).trim();
|
||||||
log.info(`Checking out PR branch: ${headBranch}`);
|
const baseSha = $("git", ["rev-parse", `origin/${baseBranch}`], { log: false }).trim();
|
||||||
$("git", ["checkout", "-B", headBranch, "FETCH_HEAD"]);
|
const summary2 = `PR branch has been fetched and checked out:
|
||||||
|
- Base branch: \`origin/${baseBranch}\` (${baseSha.substring(0, 7)})
|
||||||
|
- PR branch: \`${headBranch}\` (checked out locally, ${currentSha.substring(0, 7)})
|
||||||
|
- Current branch: \`${currentBranch}\`
|
||||||
|
- View diff: \`git diff origin/${baseBranch}...HEAD\``;
|
||||||
return {
|
return {
|
||||||
number: data.number,
|
number: data.number,
|
||||||
url: data.html_url,
|
url: data.html_url,
|
||||||
@@ -124820,7 +124762,9 @@ var PullRequestInfoTool = tool({
|
|||||||
draft: data.draft,
|
draft: data.draft,
|
||||||
merged: data.merged,
|
merged: data.merged,
|
||||||
base: baseBranch,
|
base: baseBranch,
|
||||||
head: headBranch
|
head: headBranch,
|
||||||
|
isFork,
|
||||||
|
summary: summary2
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -125202,17 +125146,11 @@ function setupGitBranch(payload) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info(`\u{1F33F} Setting up git branch: ${branch}`);
|
log.info(`\u{1F33F} Setting up git branch: ${branch}`);
|
||||||
const issueNumber = "issue_number" in payload.event ? payload.event.issue_number : void 0;
|
if (payload.event.is_pr === true && payload.event.issue_number) {
|
||||||
const isLikelyPR = issueNumber !== void 0 && branch !== void 0;
|
const prNumber = payload.event.issue_number;
|
||||||
if (isLikelyPR) {
|
|
||||||
try {
|
try {
|
||||||
log.debug(`Fetching PR #${issueNumber} using refs/pull/${issueNumber}/head`);
|
log.debug(`Checking out PR #${prNumber} using gh pr checkout`);
|
||||||
execSync(`git fetch origin refs/pull/${issueNumber}/head`, {
|
execSync(`gh pr checkout ${prNumber}`, {
|
||||||
cwd: repoDir,
|
|
||||||
stdio: "pipe"
|
|
||||||
});
|
|
||||||
log.debug(`Checking out branch: ${branch}`);
|
|
||||||
execSync(`git checkout -B ${branch} FETCH_HEAD`, {
|
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
stdio: "pipe"
|
stdio: "pipe"
|
||||||
});
|
});
|
||||||
@@ -125220,7 +125158,7 @@ function setupGitBranch(payload) {
|
|||||||
return;
|
return;
|
||||||
} catch (error41) {
|
} catch (error41) {
|
||||||
log.debug(
|
log.debug(
|
||||||
`PR ref fetch failed, falling back to branch name fetch: ${error41 instanceof Error ? error41.message : String(error41)}`
|
`gh pr checkout failed, falling back to branch name fetch: ${error41 instanceof Error ? error41.message : String(error41)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pullfrog/action",
|
"name": "@pullfrog/action",
|
||||||
"version": "0.0.136",
|
"version": "0.0.137",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
|
|||||||
Reference in New Issue
Block a user