Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

feat(gui): add a GitHub hub for issues and pull requests

Rach Pradhan01bda3569540
diff --git a/apps/native/components/site/ChangesPane.tsx b/apps/native/components/site/ChangesPane.tsx
index df002481..846365ee 100644
--- a/apps/native/components/site/ChangesPane.tsx
+++ b/apps/native/components/site/ChangesPane.tsx
@@ -6,8 +6,8 @@ import ReviewDiff from "./ReviewDiff";
import { reviewLines } from "@/lib/review-lines";
import styles from "./ChangesPane.module.css";
import ResizableReviewPane from "./ResizableReviewPane";
-function Icon({ kind }: { kind: "close" | "files" | "up" | "down" | "history" | "refresh" }) {
- const paths = { close: "M6 6l12 12M6 18 18 6", files: "M8 6h12M8 12h12M8 18h12M3 6h.01M3 12h.01M3 18h.01", up: "m6 14 6-6 6 6", down: "m6 10 6 6 6-6", history: "M3 10a9 9 0 1 1 1 7M3 4v6h6M12 7v5l3 2", refresh: "M4 10a8 8 0 1 1 0 5M4 4v6h6" };
+function Icon({ kind }: { kind: "close" | "files" | "up" | "down" | "history" | "refresh" | "issue" }) {
+ const paths = { close: "M6 6l12 12M6 18 18 6", files: "M8 6h12M8 12h12M8 18h12M3 6h.01M3 12h.01M3 18h.01", up: "m6 14 6-6 6 6", down: "m6 10 6 6 6-6", history: "M3 10a9 9 0 1 1 1 7M3 4v6h6M12 7v5l3 2", refresh: "M4 10a8 8 0 1 1 0 5M4 4v6h6", issue: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20M12 11a1 1 0 1 1 0 2 1 1 0 0 1 0-2" };
return <svg aria-hidden="true" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" strokeLinejoin="round"><path d={paths[kind]} /></svg>;
}
const button = "flex size-7 shrink-0 items-center justify-center rounded-md text-ink-3 hover:bg-hover hover:text-ink disabled:opacity-30";
@@ -69,6 +69,10 @@ export default function ChangesPane({ root, onClose }: { root?: string; onClose(
<span className="rounded-md bg-hover px-1.5 py-0.5 text-[10px] tabular-nums text-ink-3">{files.length}</span>
<div className="min-w-0 flex-1 truncate pl-1 text-[11px] text-ink-3" title={state?.branch}>{state?.branch}</div>
<span className={`size-1.5 shrink-0 rounded-full ${error ? "bg-orange" : "bg-green/70"}`} title={error ? "Updates unavailable; retrying every five seconds" : "Refreshes every five seconds while visible"} aria-label={error ? "Updates unavailable" : "Live updates"} />
+ {state?.github ? <>
+ <button type="button" className="flex h-7 shrink-0 items-center rounded-md px-2 text-[11px] text-ink-3 hover:bg-hover hover:text-ink" title="Open GitHub issues" aria-label="Open GitHub issues" onClick={() => window.open(state.github!.list, "_blank", "noopener")}>Issues</button>
+ <button type="button" className="flex h-7 shrink-0 items-center rounded-md px-2 text-[11px] text-ink-3 hover:bg-hover hover:text-ink" title="Create a GitHub issue" aria-label="Create a GitHub issue" onClick={() => window.open(state.github!.create, "_blank", "noopener")}><Icon kind="issue" /><span className="ml-1">New issue</span></button>
+ </> : null}
<button className={button} title="Refresh changes" aria-label="Refresh changes" onClick={() => setRevision(value => value + 1)}><Icon kind="refresh" /></button>
<button className={button} title="Close changes" aria-label="Close changes" onClick={onClose}><Icon kind="close" /></button>
</header>
diff --git a/apps/native/lib/git-review.test.ts b/apps/native/lib/git-review.test.ts
index bcbd7e39..d39a1a11 100644
--- a/apps/native/lib/git-review.test.ts
+++ b/apps/native/lib/git-review.test.ts
@@ -4,7 +4,7 @@ import { mkdtempSync, writeFileSync, rmSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { execFileSync } from "node:child_process";
-import { reviewState, reviewDiff } from "./git-review";
+import { reviewState, reviewDiff, githubIssueUrlsFromRemote } from "./git-review";
test("shared review includes staged, unstaged, new and deleted files without shell path interpretation", async () => {
const root = mkdtempSync(path.join(os.tmpdir(), 'graff-review-'));
const git = (...args: string[]) => execFileSync('git', args, { cwd: root, stdio: 'ignore' });
@@ -45,3 +45,23 @@ test("numstat retains tabs in file names", async () => {
assert.equal(state.totalAdd, 2);
} finally { rmSync(root, { recursive: true, force: true }); }
});
+test("github issue URLs come from a GitHub origin and stay off other remotes", async () => {
+ assert.deepEqual(githubIssueUrlsFromRemote("https://github.com/justrach/codegraff.git"), {
+ list: "https://github.com/justrach/codegraff/issues",
+ create: "https://github.com/justrach/codegraff/issues/new",
+ });
+ assert.deepEqual(githubIssueUrlsFromRemote("[email protected]:justrach/codegraff.git"), {
+ list: "https://github.com/justrach/codegraff/issues",
+ create: "https://github.com/justrach/codegraff/issues/new",
+ });
+ assert.equal(githubIssueUrlsFromRemote("https://gitlab.com/justrach/codegraff.git"), null);
+ const root = mkdtempSync(path.join(os.tmpdir(), "graff-review-github-"));
+ try {
+ execFileSync("git", ["init", "-q", root]);
+ execFileSync("git", ["remote", "add", "origin", "https://github.com/justrach/codegraff.git"], { cwd: root });
+ assert.deepEqual((await reviewState(root)).github, {
+ list: "https://github.com/justrach/codegraff/issues",
+ create: "https://github.com/justrach/codegraff/issues/new",
+ });
+ } finally { rmSync(root, { recursive: true, force: true }); }
+});
diff --git a/apps/native/lib/git-review.ts b/apps/native/lib/git-review.ts
index a0b4ecdb..5f2d519b 100644
--- a/apps/native/lib/git-review.ts
+++ b/apps/native/lib/git-review.ts
@@ -4,8 +4,22 @@ import path from "node:path";
const run = promisify(execFile);
export type ReviewScope = "all" | "staged" | "unstaged";
export type ReviewFile = { path: string; add: number; del: number; untracked: boolean; status: string; binary: boolean };
+export type GithubIssueUrls = { list: string; create: string };
export type ReviewState = { root: string; branch: string; files: ReviewFile[]; totalAdd: number; totalDel: number;
- commits: { hash: string; author: string; subject: string }[]; worktrees: { path: string; branch: string }[] };
+ commits: { hash: string; author: string; subject: string }[]; worktrees: { path: string; branch: string }[];
+ github: GithubIssueUrls | null };
+/** Issue pages for a GitHub origin remote (`https`, `ssh`, or `git`). */
+export function githubIssueUrlsFromRemote(remote: string): GithubIssueUrls | null {
+ const trimmed = remote.trim().replace(/\/+$/, "").replace(/\.git$/i, "");
+ const ownerRepo =
+ trimmed.match(/^https?:\/\/(?:www\.)?github\.com\/([^/]+\/[^/]+)$/i)?.[1] ??
+ trimmed.match(/^(?:ssh:\/\/)?git@github\.com[:/]([^/]+\/[^/]+)$/i)?.[1] ??
+ trimmed.match(/^git:\/\/github\.com\/([^/]+\/[^/]+)$/i)?.[1] ??
+ null;
+ if (!ownerRepo || ownerRepo.split("/").length !== 2) return null;
+ const base = `https://github.com/${ownerRepo}`;
+ return { list: `${base}/issues`, create: `${base}/issues/new` };
+}
async function git(root: string, args: string[], diff = false) {
try { return (await run("git", ["--no-pager", ...args], { cwd: root, timeout: 10000, maxBuffer: 4 * 1024 * 1024, env: { ...process.env, GIT_OPTIONAL_LOCKS: "0", GIT_LITERAL_PATHSPECS: "1" } })).stdout; }
catch (error) { if (diff && (error as { code?: number }).code === 1) return (error as { stdout: string }).stdout; throw error; }
@@ -21,11 +35,12 @@ export async function reviewDiff(root: string, file: string, scope: ReviewScope
return git(root, [...base, ...(scope === "all" && !head ? ["--cached"] : scopeArgs(scope)), "--", file]);
}
export async function reviewState(root: string, scope: ReviewScope = "all"): Promise<ReviewState> {
- const [status, branch, log, worktreeText] = await Promise.all([
+ const [status, branch, log, worktreeText, origin] = await Promise.all([
git(root, ["status", "--porcelain=v1", "-z", "--untracked-files=all"]),
git(root, ["branch", "--show-current"]).catch(() => ""),
git(root, ["log", "-8", "--format=%h%x00%an%x00%s"]).catch(() => ""),
git(root, ["worktree", "list", "--porcelain"]).catch(() => ""),
+ git(root, ["remote", "get-url", "origin"]).catch(() => ""),
]);
const entries = status.split("\0"); const files: ReviewFile[] = [];
for (let i = 0; i < entries.length; i++) {
@@ -51,5 +66,6 @@ export async function reviewState(root: string, scope: ReviewScope = "all"): Pro
}));
return { root, branch: branch.trim() || "detached", files: files.sort((a, b) => a.path.localeCompare(b.path)),
totalAdd: files.reduce((n, f) => n + f.add, 0), totalDel: files.reduce((n, f) => n + f.del, 0),
- commits: log.trim().split("\n").filter(Boolean).map(row => { const [hash, author, ...subject] = row.split("\0"); return { hash, author, subject: subject.join(" ") }; }), worktrees };
+ commits: log.trim().split("\n").filter(Boolean).map(row => { const [hash, author, ...subject] = row.split("\0"); return { hash, author, subject: subject.join(" ") }; }), worktrees,
+ github: githubIssueUrlsFromRemote(origin) };
}
diff --git a/gui/src/components/conversation-panel/ConversationDockviewTab.tsx b/gui/src/components/conversation-panel/ConversationDockviewTab.tsx
index 0cd33cc0..5143ec65 100644
--- a/gui/src/components/conversation-panel/ConversationDockviewTab.tsx
+++ b/gui/src/components/conversation-panel/ConversationDockviewTab.tsx
@@ -1,4 +1,4 @@
-import { ChevronRight, GitFork } from "lucide-react";
+import { ChevronRight } from "lucide-react";
import { useSidebarVisible } from "@/app/sidebarVisibilityContext";
import {
@@ -9,6 +9,7 @@ import {
import { cn } from "@/utils/cn";
import { BranchSwitcherMenu } from "./BranchSwitcherMenu";
+import { GithubHubMenu } from "./GithubHubMenu";
import { ProjectSwitcherMenu } from "./ProjectSwitcherMenu";
import { useConversationHeaderState } from "./hooks/useConversationHeaderState";
import type { ConversationDockviewTabProps } from "./types/conversationHeader";
@@ -73,10 +74,7 @@ export function ConversationDockviewTab({
event.stopPropagation();
}}
>
- <GitFork
- strokeWidth={2}
- className="size-3 shrink-0 text-muted-foreground"
- />
+ <GithubHubMenu repoName={repoName} branchName={branchName} />
<ProjectSwitcherMenu
currentProjectLabel={repoName ?? currentProjectLabel}
isBusy={isProjectChangePending}
diff --git a/gui/src/components/conversation-panel/GithubHubMenu.test.tsx b/gui/src/components/conversation-panel/GithubHubMenu.test.tsx
new file mode 100644
index 00000000..8b2461f2
--- /dev/null
+++ b/gui/src/components/conversation-panel/GithubHubMenu.test.tsx
@@ -0,0 +1,33 @@
+import { expect, test } from "bun:test";
+import { renderToStaticMarkup } from "react-dom/server";
+
+import { GithubHubCard } from "./GithubHubMenu";
+
+test("showcases GitHub issue and pull request actions for a repo", () => {
+ const html = renderToStaticMarkup(
+ <GithubHubCard repoName="justrach/codegraff" branchName="main" />,
+ );
+
+ expect(html).toContain("justrach/codegraff");
+ expect(html).toContain("main");
+ expect(html).toContain("Issues");
+ expect(html).toContain("New issue");
+ expect(html).toContain("Pull requests");
+ expect(html).toContain("New pull request");
+ expect(html).toContain("Open repository");
+ expect(html).toContain("Compare this branch");
+});
+
+test("hides compare when the branch is not a real ref", () => {
+ const html = renderToStaticMarkup(
+ <GithubHubCard repoName="justrach/codegraff" branchName="HEAD" />,
+ );
+
+ expect(html).toContain("New pull request");
+ expect(html).not.toContain("Compare this branch");
+});
+
+test("renders nothing for a non-GitHub repo name", () => {
+ const html = renderToStaticMarkup(<GithubHubCard repoName="not-a-repo" />);
+ expect(html).toBe("");
+});
diff --git a/gui/src/components/conversation-panel/GithubHubMenu.tsx b/gui/src/components/conversation-panel/GithubHubMenu.tsx
new file mode 100644
index 00000000..90a7e788
--- /dev/null
+++ b/gui/src/components/conversation-panel/GithubHubMenu.tsx
@@ -0,0 +1,204 @@
+import {
+ CircleDotIcon,
+ ExternalLinkIcon,
+ GitCompareIcon,
+ GitForkIcon,
+ GitPullRequestCreateIcon,
+ GitPullRequestIcon,
+} from "lucide-react";
+
+import { Button } from "@/components/ui/Button";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/Popover";
+import { openExternalUrl } from "@/services/desktop/client";
+import { cn } from "@/utils/cn";
+
+import {
+ githubRepoUrls,
+ type GithubRepoUrls,
+} from "./utils/githubIssues";
+
+function openGithub(url: string) {
+ void openExternalUrl(url).catch((error) => {
+ console.error("Failed to open GitHub", error);
+ });
+}
+
+const tileClassName =
+ "flex min-h-14 flex-col items-start justify-center gap-1 rounded-md border border-border/80 bg-background/70 px-3 py-2 text-left transition-colors hover:border-accent/40 hover:bg-accent/5";
+
+function GithubActionGrid({ urls }: { urls: GithubRepoUrls }) {
+ return (
+ <div className="grid grid-cols-2 gap-1.5">
+ <button
+ type="button"
+ className={tileClassName}
+ onClick={() => openGithub(urls.issues)}
+ >
+ <CircleDotIcon className="size-3.5 text-muted-foreground" />
+ <span className="text-xs font-medium">Issues</span>
+ </button>
+ <button
+ type="button"
+ className={tileClassName}
+ onClick={() => openGithub(urls.createIssue)}
+ >
+ <CircleDotIcon className="size-3.5 text-muted-foreground" />
+ <span className="text-xs font-medium">New issue</span>
+ </button>
+ <button
+ type="button"
+ className={tileClassName}
+ onClick={() => openGithub(urls.pulls)}
+ >
+ <GitPullRequestIcon className="size-3.5 text-muted-foreground" />
+ <span className="text-xs font-medium">Pull requests</span>
+ </button>
+ <button
+ type="button"
+ className={tileClassName}
+ onClick={() => openGithub(urls.createPull)}
+ >
+ <GitPullRequestCreateIcon className="size-3.5 text-muted-foreground" />
+ <span className="text-xs font-medium">New pull request</span>
+ </button>
+ </div>
+ );
+}
+
+function GithubHubBody({
+ repoName,
+ branchName,
+ urls,
+}: {
+ repoName: string;
+ branchName?: string | null;
+ urls: GithubRepoUrls;
+}) {
+ return (
+ <div className="flex flex-col gap-3">
+ <div className="flex min-w-0 items-center gap-2.5">
+ <span className="flex size-8 shrink-0 items-center justify-center rounded-md bg-accent/10 text-accent">
+ <GitForkIcon className="size-4" />
+ </span>
+ <div className="min-w-0">
+ <div className="truncate font-medium tracking-tight text-foreground">
+ {repoName}
+ </div>
+ {branchName != null && branchName.length > 0 ? (
+ <div className="truncate font-mono text-[11px] text-muted-foreground">
+ {branchName}
+ </div>
+ ) : (
+ <div className="text-[11px] text-muted-foreground">GitHub</div>
+ )}
+ </div>
+ </div>
+ <GithubActionGrid urls={urls} />
+ <div className="flex flex-col">
+ <button
+ type="button"
+ className="inline-flex h-7 items-center justify-between gap-2 rounded-md px-2 text-xs text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground"
+ onClick={() => openGithub(urls.repo)}
+ >
+ Open repository
+ <ExternalLinkIcon className="size-3" />
+ </button>
+ {urls.compare != null ? (
+ <button
+ type="button"
+ className="inline-flex h-7 items-center justify-between gap-2 rounded-md px-2 text-xs text-muted-foreground transition-colors hover:bg-foreground/5 hover:text-foreground"
+ onClick={() => openGithub(urls.compare!)}
+ >
+ Compare this branch
+ <GitCompareIcon className="size-3" />
+ </button>
+ ) : null}
+ </div>
+ </div>
+ );
+}
+
+export function GithubHubCard({
+ repoName,
+ branchName,
+ className,
+}: {
+ repoName: string;
+ branchName?: string | null;
+ className?: string;
+}) {
+ const urls = githubRepoUrls(repoName, branchName);
+ if (urls == null) {
+ return null;
+ }
+
+ return (
+ <div
+ className={cn(
+ "rounded-lg bg-card p-3 text-xs shadow-[var(--elevation-sm)] ring-1 ring-foreground/10",
+ className,
+ )}
+ >
+ <GithubHubBody repoName={repoName} branchName={branchName} urls={urls} />
+ </div>
+ );
+}
+
+export function GithubHubMenu({
+ repoName,
+ branchName,
+ labeled = false,
+}: {
+ repoName: string;
+ branchName?: string | null;
+ labeled?: boolean;
+}) {
+ const urls = githubRepoUrls(repoName, branchName);
+ if (urls == null) {
+ return (
+ <GitForkIcon
+ strokeWidth={2}
+ className="size-3 shrink-0 text-muted-foreground"
+ />
+ );
+ }
+
+ return (
+ <Popover>
+ <PopoverTrigger
+ render={
+ labeled ? (
+ <Button
+ variant="outline"
+ size="sm"
+ aria-label={`GitHub for ${repoName}`}
+ title={`GitHub · ${repoName}`}
+ />
+ ) : (
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-label={`GitHub for ${repoName}`}
+ title={`GitHub · ${repoName}`}
+ className="-ml-0.5 text-muted-foreground hover:text-foreground"
+ />
+ )
+ }
+ >
+ <GitForkIcon
+ strokeWidth={2}
+ className={labeled ? undefined : "size-3"}
+ data-icon={labeled ? "inline-start" : undefined}
+ />
+ {labeled ? "GitHub" : null}
+ </PopoverTrigger>
+ <PopoverContent align="start" className="w-72 p-3">
+ <GithubHubBody repoName={repoName} branchName={branchName} urls={urls} />
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/gui/src/components/conversation-panel/utils/githubIssues.test.ts b/gui/src/components/conversation-panel/utils/githubIssues.test.ts
new file mode 100644
index 00000000..8a2ee84d
--- /dev/null
+++ b/gui/src/components/conversation-panel/utils/githubIssues.test.ts
@@ -0,0 +1,66 @@
+import { describe, expect, test } from "bun:test";
+
+import {
+ githubCompareRef,
+ githubIssueUrls,
+ githubRepoUrls,
+} from "./githubIssues";
+
+describe("githubIssueUrls", () => {
+ test("builds list and new-issue URLs from owner/repo", () => {
+ expect(githubIssueUrls("justrach/codegraff")).toEqual({
+ list: "https://github.com/justrach/codegraff/issues",
+ create: "https://github.com/justrach/codegraff/issues/new",
+ });
+ });
+
+ test("accepts dots, hyphens, and underscores in either segment", () => {
+ expect(githubIssueUrls("org-name/my.repo_name")?.list).toBe(
+ "https://github.com/org-name/my.repo_name/issues",
+ );
+ });
+
+ test("rejects missing, blank, or malformed names", () => {
+ expect(githubIssueUrls(null)).toBeNull();
+ expect(githubIssueUrls(undefined)).toBeNull();
+ expect(githubIssueUrls("")).toBeNull();
+ expect(githubIssueUrls(" ")).toBeNull();
+ expect(githubIssueUrls("only-owner")).toBeNull();
+ expect(githubIssueUrls("owner/repo/extra")).toBeNull();
+ expect(githubIssueUrls("https://github.com/owner/repo")).toBeNull();
+ expect(githubIssueUrls("owner/repo.git")).toEqual({
+ list: "https://github.com/owner/repo/issues",
+ create: "https://github.com/owner/repo/issues/new",
+ });
+ });
+});
+
+describe("githubRepoUrls", () => {
+ test("covers repo, issues, pulls, and a branch compare", () => {
+ expect(githubRepoUrls("justrach/codegraff", "fix/github-hub")).toEqual({
+ repo: "https://github.com/justrach/codegraff",
+ issues: "https://github.com/justrach/codegraff/issues",
+ createIssue: "https://github.com/justrach/codegraff/issues/new",
+ pulls: "https://github.com/justrach/codegraff/pulls",
+ createPull:
+ "https://github.com/justrach/codegraff/compare/fix%2Fgithub-hub?expand=1",
+ compare: "https://github.com/justrach/codegraff/compare/fix%2Fgithub-hub",
+ });
+ });
+
+ test("omits compare and uses a blank compare form without a branch", () => {
+ expect(githubRepoUrls("justrach/codegraff")?.compare).toBeNull();
+ expect(githubRepoUrls("justrach/codegraff")?.createPull).toBe(
+ "https://github.com/justrach/codegraff/compare?expand=1",
+ );
+ });
+});
+
+describe("githubCompareRef", () => {
+ test("strips origin/ and ignores detached HEAD", () => {
+ expect(githubCompareRef("origin/release/v0.0.299")).toBe("release/v0.0.299");
+ expect(githubCompareRef("HEAD")).toBeNull();
+ expect(githubCompareRef("detached")).toBeNull();
+ expect(githubCompareRef(" ")).toBeNull();
+ });
+});
diff --git a/gui/src/components/conversation-panel/utils/githubIssues.ts b/gui/src/components/conversation-panel/utils/githubIssues.ts
new file mode 100644
index 00000000..ec8885c8
--- /dev/null
+++ b/gui/src/components/conversation-panel/utils/githubIssues.ts
@@ -0,0 +1,73 @@
+const REPO_NAME = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
+
+function normalizeRepoName(repoName: string | null | undefined): string | null {
+ if (repoName == null) {
+ return null;
+ }
+
+ const trimmed = repoName.trim().replace(/\.git$/i, "");
+ return REPO_NAME.test(trimmed) ? trimmed : null;
+}
+
+/** Branch name GitHub compare/PR forms accept, or null when there isn't one. */
+export function githubCompareRef(
+ branchName: string | null | undefined,
+): string | null {
+ if (branchName == null) {
+ return null;
+ }
+
+ const name = branchName.trim().replace(/^origin\//, "");
+ if (name.length === 0 || name === "HEAD" || name === "detached") {
+ return null;
+ }
+
+ return name;
+}
+
+export interface GithubRepoUrls {
+ repo: string;
+ issues: string;
+ createIssue: string;
+ pulls: string;
+ createPull: string;
+ compare: string | null;
+}
+
+/** GitHub pages for a workspace `owner/repo` remote and optional branch. */
+export function githubRepoUrls(
+ repoName: string | null | undefined,
+ branchName?: string | null,
+): GithubRepoUrls | null {
+ const repo = normalizeRepoName(repoName);
+ if (repo == null) {
+ return null;
+ }
+
+ const base = `https://github.com/${repo}`;
+ const ref = githubCompareRef(branchName);
+ return {
+ repo: base,
+ issues: `${base}/issues`,
+ createIssue: `${base}/issues/new`,
+ pulls: `${base}/pulls`,
+ createPull:
+ ref == null
+ ? `${base}/compare?expand=1`
+ : `${base}/compare/${encodeURIComponent(ref)}?expand=1`,
+ compare: ref == null ? null : `${base}/compare/${encodeURIComponent(ref)}`,
+ };
+}
+
+export interface GithubIssueUrls {
+ list: string;
+ create: string;
+}
+
+/** Issue pages for a GitHub `owner/repo` remote name (as `gitRepoName`). */
+export function githubIssueUrls(
+ repoName: string | null | undefined,
+): GithubIssueUrls | null {
+ const urls = githubRepoUrls(repoName);
+ return urls == null ? null : { list: urls.issues, create: urls.createIssue };
+}
diff --git a/gui/src/components/workspace-board/ChangesPane.tsx b/gui/src/components/workspace-board/ChangesPane.tsx
index 95611735..27e48aa0 100644
--- a/gui/src/components/workspace-board/ChangesPane.tsx
+++ b/gui/src/components/workspace-board/ChangesPane.tsx
@@ -3,7 +3,10 @@ import type { IDockviewPanelProps } from "dockview-react";
import {
ChevronDownIcon,
ChevronRight,
+ CircleDotIcon,
ExternalLinkIcon,
+ GitPullRequestCreateIcon,
+ GitPullRequestIcon,
GitCommitHorizontalIcon,
UploadIcon,
} from "lucide-react";
@@ -18,6 +21,9 @@ import {
import { usePreferredOpenTarget } from "@/components/conversation-panel/hooks/usePreferredOpenTarget";
import { useConversationHeaderState } from "@/components/conversation-panel/hooks/useConversationHeaderState";
import { CommitChangesDialog } from "@/components/conversation-panel/CommitChangesDialog";
+import { GithubHubCard, GithubHubMenu } from "@/components/conversation-panel/GithubHubMenu";
+import { githubRepoUrls } from "@/components/conversation-panel/utils/githubIssues";
+import { openExternalUrl } from "@/services/desktop/client";
import {
getFileDiffDisplayName,
getFileDiffDisplayPath,
@@ -245,6 +251,16 @@ export function ChangesPane({
void openWorkspacePathInTarget(params.workspacePath, resolvedPreferredAppId, path);
};
+ const github =
+ showGitActions && repoName != null
+ ? githubRepoUrls(repoName, branchName)
+ : null;
+ const openGithub = (url: string) => {
+ void openExternalUrl(url).catch((error) => {
+ console.error("Failed to open GitHub", error);
+ });
+ };
+
return (
<PaneSurface className="overflow-auto">
<div className="sticky top-0 z-10 flex items-center justify-between gap-3 border-b border-border bg-background/70 px-4 py-2 text-xs backdrop-blur-md">
@@ -277,50 +293,92 @@ export function ChangesPane({
</span>
</div>
{showGitActions ? (
- <ButtonGroup aria-label="Git actions">
- <Button
- variant="outline"
- size="sm"
- disabled={isGitActionPending}
- onClick={openCommitDialog}
- >
- <GitCommitHorizontalIcon data-icon="inline-start" />
- Commit or push
- </Button>
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- variant="outline"
- size="icon-sm"
- aria-label="More git actions"
- disabled={isGitActionPending}
- />
- }
+ <div className="flex shrink-0 items-center gap-1.5">
+ {github != null && repoName != null ? (
+ <GithubHubMenu
+ repoName={repoName}
+ branchName={branchName}
+ labeled
+ />
+ ) : null}
+ <ButtonGroup aria-label="Git actions">
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={isGitActionPending}
+ onClick={openCommitDialog}
>
- <ChevronDownIcon />
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-40">
- <DropdownMenuGroup>
- <DropdownMenuItem
- onClick={() => {
- void handlePush();
- }}
- disabled={isGitActionPending}
- >
- <UploadIcon />
- Push
- </DropdownMenuItem>
- </DropdownMenuGroup>
- </DropdownMenuContent>
- </DropdownMenu>
- </ButtonGroup>
+ <GitCommitHorizontalIcon data-icon="inline-start" />
+ Commit or push
+ </Button>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="outline"
+ size="icon-sm"
+ aria-label="More git actions"
+ disabled={isGitActionPending}
+ />
+ }
+ >
+ <ChevronDownIcon />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-44">
+ <DropdownMenuGroup>
+ <DropdownMenuItem
+ onClick={() => {
+ void handlePush();
+ }}
+ disabled={isGitActionPending}
+ >
+ <UploadIcon />
+ Push
+ </DropdownMenuItem>
+ {github != null ? (
+ <>
+ <DropdownMenuItem
+ onClick={() => openGithub(github.issues)}
+ >
+ <CircleDotIcon />
+ Open issues
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => openGithub(github.createIssue)}
+ >
+ <CircleDotIcon />
+ New issue
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => openGithub(github.pulls)}
+ >
+ <GitPullRequestIcon />
+ Pull requests
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => openGithub(github.createPull)}
+ >
+ <GitPullRequestCreateIcon />
+ New pull request
+ </DropdownMenuItem>
+ </>
+ ) : null}
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ButtonGroup>
+ </div>
) : null}
</div>
{changes.length === 0 ? (
- <div className="px-4 py-10 text-center text-xs text-muted-foreground">
- File edits made during this conversation will appear here.
+ <div className="flex flex-col gap-4 px-4 py-6">
+ {github != null && repoName != null ? (
+ <GithubHubCard repoName={repoName} branchName={branchName} />
+ ) : null}
+ <p className="text-center text-xs text-muted-foreground">
+ File edits made during this conversation will appear here.
+ </p>
</div>
) : (
<div className="flex flex-col">