Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(help): Report-a-bug dialog (prefilled GitHub issue)

enes97fca1287424
diff --git a/src/renderer/components/BugReportDialog.tsx b/src/renderer/components/BugReportDialog.tsx
new file mode 100644
index 000000000..885f3e4a5
--- /dev/null
+++ b/src/renderer/components/BugReportDialog.tsx
@@ -0,0 +1,90 @@
+import { useEffect, useRef, useState } from 'react'
+import { createPortal } from 'react-dom'
+import { useDialogStack } from './dialog-stack'
+import { BODY_BUDGET, buildBugReportUrl, envBlock, type BugReportEnv } from '../lib/bugReport'
+
+interface BugReportDialogProps {
+ env: BugReportEnv
+ /** Receives the composed issues/new URL; the caller opens it (shell.openExternal). */
+ onOpen: (url: string) => void
+ onClose: () => void
+}
+
+/**
+ * "Report a bug" — composes a prefilled GitHub issue and hands the URL to the caller.
+ * A prefilled URL cannot carry attachments, hence the paste-on-GitHub note; the env
+ * block preview shows exactly what gets appended to the body.
+ */
+export function BugReportDialog({ env, onOpen, onClose }: BugReportDialogProps) {
+ const [title, setTitle] = useState('')
+ const [description, setDescription] = useState('')
+ const titleRef = useRef<HTMLInputElement>(null)
+ useDialogStack()
+
+ useEffect(() => {
+ titleRef.current?.focus()
+ }, [])
+
+ const willTruncate = description.length > BODY_BUDGET - 200
+ const canSubmit = title.trim().length > 0
+
+ const submit = () => {
+ if (!canSubmit) return
+ const { url } = buildBugReportUrl(title.trim(), description, env)
+ onOpen(url)
+ onClose()
+ }
+
+ return createPortal(
+ <div className="confirm-overlay" onClick={onClose}>
+ <div
+ className="confirm bug-report"
+ onClick={(e) => e.stopPropagation()}
+ onKeyDown={(e) => {
+ if (e.key === 'Escape') {
+ e.preventDefault()
+ onClose()
+ }
+ }}
+ >
+ <p className="confirm__msg">Report a bug</p>
+ <input
+ ref={titleRef}
+ className="confirm__input"
+ value={title}
+ placeholder="Short summary of the problem"
+ spellCheck={false}
+ onChange={(e) => setTitle(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ e.preventDefault()
+ submit()
+ }
+ }}
+ />
+ <textarea
+ className="confirm__input bug-report__desc"
+ value={description}
+ placeholder={'What did you do?\nWhat did you expect?\nWhat happened instead?'}
+ spellCheck={false}
+ onChange={(e) => setDescription(e.target.value)}
+ />
+ <pre className="bug-report__env">{envBlock(env)}</pre>
+ <p className="bug-report__note">
+ Opens a prefilled issue on GitHub — you submit it from your own account. Screenshots or
+ logs can be pasted there.
+ {willTruncate ? ' Long descriptions are truncated to fit the URL.' : ''}
+ </p>
+ <div className="confirm__actions">
+ <button className="confirm__btn" onClick={onClose}>
+ Cancel
+ </button>
+ <button className="confirm__btn primary" disabled={!canSubmit} onClick={submit}>
+ Open on GitHub
+ </button>
+ </div>
+ </div>
+ </div>,
+ document.body
+ )
+}
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index 441d16306..7538421c5 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -5680,3 +5680,36 @@ body,
color: var(--muted);
border: 1px solid var(--border);
}
+
+/* ---- Bug report dialog (help menu → Report a bug…) ---- */
+.bug-report {
+ width: 440px;
+}
+
+.bug-report__desc {
+ min-height: 110px;
+ resize: vertical;
+ font: inherit;
+ line-height: 1.45;
+}
+
+/* Read-only preview of the environment block appended to the issue body. */
+.bug-report__env {
+ margin: 10px 0 0;
+ padding: 8px 10px;
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 11px;
+ line-height: 1.5;
+ color: var(--muted);
+ background: rgba(0, 0, 0, 0.3);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ white-space: pre-wrap;
+}
+
+.bug-report__note {
+ margin: 10px 0 14px;
+ font-size: 11px;
+ line-height: 1.5;
+ color: var(--muted);
+}