private static formatIssueForDescription()

in app/lib/issueEnhancer.ts [128:162]


  private static formatIssueForDescription(issue: GitHubIssue): string {
    const statusEmoji = issue.state === "open" ? "🔓" : "✅";
    const labels =
      issue.labels.length > 0
        ? ` [${issue.labels.map((l) => l.name).join(", ")}]`
        : "";

    let issueText = `${statusEmoji} Issue #${issue.number}: "${issue.title}"${labels}`;

    // Add issue body if it exists and is not too long
    if (issue.body && issue.body.trim()) {
      const body = issue.body.trim();
      // Clean up markdown and limit length
      const cleanBody = body
        .replace(/```[\s\S]*?```/g, "[code block]") // Replace code blocks
        .replace(/!\[.*?\]\(.*?\)/g, "[image]") // Replace images
        .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1") // Convert links to just text
        .replace(/#+\s*/g, "") // Remove markdown headers
        .replace(/\*\*(.*?)\*\*/g, "$1") // Remove bold
        .replace(/\*(.*?)\*/g, "$1") // Remove italic
        .replace(/\s+/g, " ") // Normalize whitespace
        .trim();

      const truncatedBody =
        cleanBody.length > 150
          ? cleanBody.substring(0, 150) + "..."
          : cleanBody;
      if (truncatedBody.length > 10) {
        // Only add if meaningful content remains
        issueText += `\n\nIssue Description:\n${truncatedBody}`;
      }
    }

    return issueText;
  }