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(git-history): commit file list + context-menu builder

enes778128fddece
diff --git a/src/renderer/components/git-history/GitHistoryCommitFiles.tsx b/src/renderer/components/git-history/GitHistoryCommitFiles.tsx
new file mode 100644
index 000000000..30644a095
--- /dev/null
+++ b/src/renderer/components/git-history/GitHistoryCommitFiles.tsx
@@ -0,0 +1,51 @@
+import type { GitFileChange } from '@shared/types'
+import { formatGitHistoryTimestamp } from './git-history-format'
+
+const STATUS_COLOR: Record<string, string> = {
+ M: '#ffd60a', A: '#32d74b', D: '#ff453a', R: '#bf5af2', U: '#6ac4dc'
+}
+
+export type GitHistoryCommitFilesState =
+ | { status: 'loading' }
+ | { status: 'error'; error: string }
+ | { status: 'ready'; entries: GitFileChange[] }
+
+export function GitHistoryCommitFiles({
+ state,
+ author,
+ timestamp,
+ onOpenFile
+}: {
+ state: GitHistoryCommitFilesState
+ author?: string
+ timestamp?: number
+ onOpenFile: (entry: GitFileChange) => void
+}) {
+ const meta = [author, formatGitHistoryTimestamp(timestamp)].filter(Boolean).join(' · ')
+ return (
+ <div className="scm-history__files">
+ {meta && <div className="scm-history__meta">{meta}</div>}
+ {state.status === 'loading' && <div className="scm-history__meta">Loading files…</div>}
+ {state.status === 'error' && <div className="scm-history__meta" style={{ color: '#ff453a' }} title={state.error}>{state.error}</div>}
+ {state.status === 'ready' && state.entries.length === 0 && (
+ <div className="scm-history__meta">No file changes in this commit</div>
+ )}
+ {state.status === 'ready' &&
+ state.entries.map((entry) => {
+ const name = entry.path.split('/').pop() || entry.path
+ const dir = entry.path.includes('/') ? entry.path.slice(0, entry.path.lastIndexOf('/')) : ''
+ return (
+ <button key={entry.path} type="button" className="scm-history__file" title={entry.path} onClick={() => onOpenFile(entry)}>
+ <span style={{ width: 12, textAlign: 'center', fontWeight: 700, fontSize: 10, color: STATUS_COLOR[entry.status] ?? 'rgba(255,255,255,0.85)' }}>
+ {entry.status}
+ </span>
+ <span style={{ minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
+ {name}
+ {dir && <span className="scm-history__file-dir">{dir}</span>}
+ </span>
+ </button>
+ )
+ })}
+ </div>
+ )
+}
diff --git a/src/renderer/components/git-history/git-history-menu.ts b/src/renderer/components/git-history/git-history-menu.ts
new file mode 100644
index 000000000..a3eadd5ea
--- /dev/null
+++ b/src/renderer/components/git-history/git-history-menu.ts
@@ -0,0 +1,19 @@
+import type { MenuItem } from '../ContextMenu'
+import type { GitHistoryItem } from '@shared/git-history'
+
+export type CommitMenuHandlers = {
+ openInBrowser: (item: GitHistoryItem) => void
+ copyHash: (item: GitHistoryItem) => void
+ copyMessage: (item: GitHistoryItem) => void
+ explain: (item: GitHistoryItem) => void
+}
+
+export function buildCommitMenuItems(item: GitHistoryItem, h: CommitMenuHandlers): MenuItem[] {
+ return [
+ { label: 'Open commit in browser', onClick: () => h.openInBrowser(item) },
+ { label: 'Copy commit hash', onClick: () => h.copyHash(item) },
+ { label: 'Copy commit message', onClick: () => h.copyMessage(item) },
+ { type: 'separator' },
+ { label: 'Explain changes with AI', onClick: () => h.explain(item) }
+ ]
+}