From e2f737a753b2bd5780f697383e5b6ad15c8f0fa9 Mon Sep 17 00:00:00 2001 From: Mark Wylde Date: Sat, 31 May 2025 01:05:34 +0100 Subject: [PATCH] Attempt to make this work --- spinner.gif => assets/spinner.gif | Bin src/create-prompt/index.ts | 11 ++++++++++- src/github/operations/comments/common.ts | 20 +++++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) rename spinner.gif => assets/spinner.gif (100%) diff --git a/spinner.gif b/assets/spinner.gif similarity index 100% rename from spinner.gif rename to assets/spinner.gif diff --git a/src/create-prompt/index.ts b/src/create-prompt/index.ts index a0d74e9..b5de87a 100644 --- a/src/create-prompt/index.ts +++ b/src/create-prompt/index.ts @@ -584,7 +584,16 @@ Important Notes: - Never create new comments. Only update the existing comment using ${eventData.eventName === "pull_request_review_comment" ? "mcp__github__update_pull_request_comment" : "mcp__github__update_issue_comment"} with comment_id: ${context.claudeCommentId}. - This includes ALL responses: code reviews, answers to questions, progress updates, and final results.${eventData.isPR ? "\n- PR CRITICAL: After reading files and forming your response, you MUST post it by calling mcp__github__update_issue_comment. Do NOT just respond with a normal response, the user will not see it." : ""} - You communicate exclusively by editing your single comment - not through any other means. -- Use this spinner HTML when work is in progress: +- Use this spinner HTML when work is in progress: ${(() => { + try { + const spinnerPath = require("path").join(__dirname, "../assets/spinner.gif"); + const spinnerBuffer = require("fs").readFileSync(spinnerPath); + const base64Data = spinnerBuffer.toString("base64"); + return ``; + } catch (error) { + return ''; + } +})()} ${eventData.isPR && !eventData.claudeBranch ? `- Always push to the existing branch when triggered on a PR.` : `- IMPORTANT: You are already on the correct branch (${eventData.claudeBranch || "the created branch"}). Never create new branches when triggered on issues or closed/merged PRs.`} - Use mcp__local_git_ops__commit_files for making commits (works for both new and existing files, single or multiple). Use mcp__local_git_ops__delete_files for deleting files (supports deleting single or multiple files atomically), or mcp__github__delete_file for deleting a single file. Edit files locally, and the tool will read the content from the same path on disk. Tool usage examples: diff --git a/src/github/operations/comments/common.ts b/src/github/operations/comments/common.ts index 2b318f2..e1828e4 100644 --- a/src/github/operations/comments/common.ts +++ b/src/github/operations/comments/common.ts @@ -1,7 +1,21 @@ import { GITEA_SERVER_URL } from "../../api/config"; +import { readFileSync } from "fs"; +import { join } from "path"; -export const SPINNER_HTML = - ''; +function getSpinnerHtml(): string { + try { + const spinnerPath = join(__dirname, "../../../assets/spinner.gif"); + const spinnerBuffer = readFileSync(spinnerPath); + const base64Data = spinnerBuffer.toString("base64"); + return ``; + } catch (error) { + console.warn("Could not load spinner image, using fallback"); + // Fallback to a simple text spinner + return ''; + } +} + +export const SPINNER_HTML = getSpinnerHtml(); export function createJobRunLink( owner: string, @@ -17,7 +31,7 @@ export function createBranchLink( repo: string, branchName: string, ): string { - const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/tree/${branchName}`; + const branchUrl = `${GITEA_SERVER_URL}/${owner}/${repo}/src/branch/${branchName}/`; return `\n[View branch](${branchUrl})`; }