feat: add functionality to dispatch Forgejo issue details as Claude Code prompt
This commit is contained in:
parent
0605c7b908
commit
0d0fccf827
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { ExternalLink, Loader2, MessageSquarePlus, Pencil, UserPlus, XCircle } from "lucide-react";
|
||||
import { ExternalLink, Loader2, MessageSquarePlus, Pencil, Terminal, UserPlus, XCircle } from "lucide-react";
|
||||
|
||||
import {
|
||||
Dialog,
|
||||
|
|
@ -131,6 +131,25 @@ export function ForgejoIssueDetailDialog({
|
|||
onRefresh?.();
|
||||
};
|
||||
|
||||
const handleDispatchToClaudeCode = async () => {
|
||||
const parts: string[] = [
|
||||
`You have been assigned a Forgejo issue.\n`,
|
||||
`**Issue**: #${active.forgejo_issue_number} ${active.title}`,
|
||||
`**Repository**: ${repositoryName}`,
|
||||
`**State**: ${active.state}`,
|
||||
];
|
||||
if (body.trim()) {
|
||||
parts.push(`\n**Description**:\n${body.trim()}`);
|
||||
}
|
||||
parts.push(`\n---\nPlease review this issue and begin working on it.`);
|
||||
const prompt = parts.join("\n");
|
||||
try {
|
||||
await navigator.clipboard.writeText(prompt);
|
||||
} catch {
|
||||
// clipboard unavailable — silently ignore
|
||||
}
|
||||
};
|
||||
|
||||
const handleEditSuccess = (updated: {
|
||||
title: string;
|
||||
body: string | null;
|
||||
|
|
@ -213,6 +232,16 @@ export function ForgejoIssueDetailDialog({
|
|||
<UserPlus className="h-3.5 w-3.5" />
|
||||
Assign Agent
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="h-9 gap-2 rounded-xl px-3 text-xs font-semibold"
|
||||
onClick={handleDispatchToClaudeCode}
|
||||
title="Copy issue as Claude Code prompt"
|
||||
>
|
||||
<Terminal className="h-3.5 w-3.5" />
|
||||
Dispatch
|
||||
</Button>
|
||||
<a
|
||||
href={active.html_url}
|
||||
target="_blank"
|
||||
|
|
|
|||
Loading…
Reference in New Issue