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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
Add editor nodes, AI naming, markdown view, explorer, and undo/redo
enes478e468056aa
diff --git a/package-lock.json b/package-lock.jsonindex 870511d09..1d8afb706 100644--- a/package-lock.json+++ b/package-lock.json@@ -10,6 +10,9 @@"hasInstallScript": true,"license": "MIT","dependencies": {+ "dompurify": "^3.4.10",+ "marked": "^12.0.2",+ "monaco-editor": "^0.52.2","node-pty": "^1.0.0","zustand": "^4.5.7"},@@ -1546,6 +1549,13 @@"@types/node": "*"}},+ "node_modules/@types/trusted-types": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",+ "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",+ "license": "MIT",+ "optional": true+ },"node_modules/@types/yauzl": {"version": "2.10.3","resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",@@ -2357,6 +2367,15 @@"license": "MIT","optional": true},+ "node_modules/dompurify": {+ "version": "3.4.10",+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.10.tgz",+ "integrity": "sha512-0xzNv0e7oYC6yyuOGZIABPM4qtg3QxLFniDNPP4ZP90wR8Yq3zgwpRbrNiT4N3IKqDbbYFEJLV+JWEs19aZ//w==",+ "license": "(MPL-2.0 OR Apache-2.0)",+ "optionalDependencies": {+ "@types/trusted-types": "^2.0.7"+ }+ },"node_modules/electron": {"version": "31.7.7","resolved": "https://registry.npmjs.org/electron/-/electron-31.7.7.tgz",@@ -3169,6 +3188,18 @@"node": ">=12"}},+ "node_modules/marked": {+ "version": "12.0.2",+ "resolved": "https://registry.npmjs.org/marked/-/marked-12.0.2.tgz",+ "integrity": "sha512-qXUm7e/YKFoqFPYPa3Ukg9xlI5cyAtGmyEIzMfW//m6kXwCy2Ps9DYf5ioijFKQ8qyuscrHoY04iJGctu2Kg0Q==",+ "license": "MIT",+ "bin": {+ "marked": "bin/marked.js"+ },+ "engines": {+ "node": ">= 18"+ }+ },"node_modules/matcher": {"version": "3.0.0","resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",@@ -3340,6 +3371,12 @@"node": ">=10"}},+ "node_modules/monaco-editor": {+ "version": "0.52.2",+ "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.52.2.tgz",+ "integrity": "sha512-GEQWEZmfkOGLdd3XK8ryrfWz3AIP8YymVXiPHEdewrUq7mh0qrKrfHLNCXcbB6sTnMLnOZ3ztSiKcciFUkIJwQ==",+ "license": "MIT"+ },"node_modules/ms": {"version": "2.1.3","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",diff --git a/package.json b/package.jsonindex c185757fa..35c9811ea 100644--- a/package.json+++ b/package.json@@ -15,6 +15,9 @@"postinstall": "electron-rebuild -f -w node-pty"},"dependencies": {+ "dompurify": "^3.4.10",+ "marked": "^12.0.2",+ "monaco-editor": "^0.52.2","node-pty": "^1.0.0","zustand": "^4.5.7"},diff --git a/src/main/commit-message.ts b/src/main/commit-message.tsindex 48233f6ad..07fe1a147 100644--- a/src/main/commit-message.ts+++ b/src/main/commit-message.ts@@ -221,14 +221,44 @@ export async function generateCommitMessage(cwd: string, settings: Settings): Prconst diff = rawDiff ? truncateDiffForPrompt(rawDiff, STAGED_DIFF_BYTE_BUDGET) : ''const prompt = buildPrompt(diff, names, settings.commitExtraPrompt)+ return runAgent(prompt, cwd, settings)+}++/** Plan + spawn the configured agent on a prompt and return its cleaned output. */+export async function runAgent(prompt: string, cwd: string, settings: Settings): Promise<GitResult> {const plan = planAgent(settings, prompt)if ('error' in plan) return { ok: false, message: plan.error }- const res = await spawnAgent(plan.bin, plan.args, cwd, plan.stdin)+ const res = await spawnAgent(plan.bin, plan.args, cwd || os.homedir(), plan.stdin)const message = cleanMessage(res.stdout)if (res.code !== 0 && !message) {return { ok: false, message: extractError(res.stderr || res.stdout) }}- if (!message) return { ok: false, message: 'Agent produced no commit message.' }+ if (!message) return { ok: false, message: 'Agent produced no output.' }return { ok: true, message }}++/** Suggest a short terminal title from its recent output. */+export async function generateTerminalName(+ content: string,+ cwd: string,+ settings: Settings+): Promise<GitResult> {+ const trimmed = content.trim()+ if (!trimmed) return { ok: false, message: 'No terminal output to read yet.' }+ const clip = trimmed.split('\n').slice(-150).join('\n').slice(-8000)+ const prompt = `Below is the recent output of a terminal session. Suggest a very short title (2-4 words, Title Case, no surrounding quotes, no trailing punctuation) describing what this terminal is used for. Output ONLY the title.++Terminal output:+\`\`\`+${clip}+\`\`\``+ const r = await runAgent(prompt, cwd, settings)+ if (!r.ok) return r+ const name = r.message+ .split('\n')[0]+ .replace(/["'`.]+$/g, '')+ .trim()+ .slice(0, 40)+ return name ? { ok: true, message: name } : { ok: false, message: 'No name produced.' }+}diff --git a/src/main/git-service.ts b/src/main/git-service.tsindex e081f3ef8..c4e716dbc 100644Binary files a/src/main/git-service.ts and b/src/main/git-service.ts differdiff --git a/src/main/index.ts b/src/main/index.tsindex 8c16a48da..99c135f77 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -1,11 +1,12 @@import { join } from 'path'+import { promises as fs } from 'fs'import { app, BrowserWindow, dialog, ipcMain, shell } from 'electron'import { IPC } from '../shared/ipc'import { PtyManager } from './pty-manager'import { WorkspaceStore } from './workspace-store'import { SettingsStore } from './settings-store'import { GitService } from './git-service'-import { generateCommitMessage } from './commit-message'+import { generateCommitMessage, generateTerminalName } from './commit-message'const settingsStore = new SettingsStore()const ptyManager = new PtyManager()@@ -32,6 +33,15 @@ function createWindow(): void {win.on('ready-to-show', () => win.show())+ // Intercept Cmd/Ctrl+M (default = minimize) and route it to the renderer for the+ // markdown-view toggle instead.+ win.webContents.on('before-input-event', (event, input) => {+ if (input.type === 'keyDown' && (input.meta || input.control) && input.key.toLowerCase() === 'm') {+ event.preventDefault()+ win.webContents.send(IPC.appToggleMarkdown)+ }+ })+// Open external links in the system browser.win.webContents.setWindowOpenHandler(({ url }) => {shell.openExternal(url)@@ -58,6 +68,48 @@ app.whenReady().then(() => {generateCommitMessage(cwd, settingsStore.get()))+ ipcMain.handle(IPC.ptyGenerateName, (_e, persistKey: string, cwd: string) =>+ generateTerminalName(ptyManager.captureSession(persistKey), cwd, settingsStore.get())+ )++ ipcMain.handle(IPC.ptyCapture, (_e, persistKey: string) => ptyManager.captureSession(persistKey))++ ipcMain.on(IPC.shellReveal, (_e, p: string) => {+ if (p) shell.showItemInFolder(p)+ })++ ipcMain.on(IPC.shellOpenPath, (_e, p: string) => {+ if (p) void shell.openPath(p)+ })++ ipcMain.handle(IPC.fsList, async (_e, dirPath: string) => {+ try {+ const entries = await fs.readdir(dirPath, { withFileTypes: true })+ return entries+ .map((e) => ({ name: e.name, dir: e.isDirectory() }))+ .sort((a, b) => (a.dir === b.dir ? a.name.localeCompare(b.name) : a.dir ? -1 : 1))+ } catch {+ return []+ }+ })++ ipcMain.handle(IPC.fsRead, async (_e, filePath: string) => {+ try {+ return await fs.readFile(filePath, 'utf-8')+ } catch {+ return ''+ }+ })++ ipcMain.handle(IPC.fsWrite, async (_e, filePath: string, content: string) => {+ try {+ await fs.writeFile(filePath, content, 'utf-8')+ return true+ } catch {+ return false+ }+ })+ipcMain.handle(IPC.dialogSelectFolder, async () => {const result = await dialog.showOpenDialog({ properties: ['openDirectory', 'createDirectory'] })return result.canceled || result.filePaths.length === 0 ? null : result.filePaths[0]diff --git a/src/main/pty-manager.ts b/src/main/pty-manager.tsindex 79d29a546..59b315da1 100644--- a/src/main/pty-manager.ts+++ b/src/main/pty-manager.ts@@ -184,6 +184,20 @@ export class PtyManager {this.sessions.delete(sessionId)}+ /** Capture a session's recent visible output (for AI naming). Empty if no tmux session. */+ captureSession(persistKey: string): string {+ if (!this.tmuxPath) return ''+ try {+ return execFileSync(+ this.tmuxPath,+ ['-L', TMUX_SOCKET, 'capture-pane', '-p', '-t', sessionName(persistKey), '-S', '-200'],+ { encoding: 'utf-8', maxBuffer: 5 * 1024 * 1024 }+ )+ } catch {+ return ''+ }+ }+/** Permanently end a node's persistent tmux session (called when the user closes it). */destroySession(persistKey: string): void {if (!this.tmuxPath) returndiff --git a/src/preload/index.ts b/src/preload/index.tsindex 28a7efff4..dd893aec0 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -1,4 +1,4 @@-import { contextBridge, ipcRenderer } from 'electron'+import { clipboard, contextBridge, ipcRenderer } from 'electron'import { IPC } from '../shared/ipc'import type {NodeTerminalApi,@@ -13,6 +13,8 @@ const api: NodeTerminalApi = {resize: (sessionId, cols, rows) => ipcRenderer.send(IPC.ptyResize, sessionId, cols, rows),kill: (sessionId) => ipcRenderer.send(IPC.ptyKill, sessionId),destroy: (persistKey) => ipcRenderer.send(IPC.ptyDestroy, persistKey),+ generateName: (persistKey, cwd) => ipcRenderer.invoke(IPC.ptyGenerateName, persistKey, cwd),+ capture: (persistKey) => ipcRenderer.invoke(IPC.ptyCapture, persistKey),onData: (sessionId, listener) => {const channel = IPC.ptyData(sessionId)const handler = (_e: unknown, data: string) => listener(data)@@ -40,6 +42,7 @@ const api: NodeTerminalApi = {git: {status: (cwd) => ipcRenderer.invoke(IPC.gitStatus, cwd),init: (cwd) => ipcRenderer.invoke(IPC.gitInit, cwd),+ clone: (parentDir, url) => ipcRenderer.invoke(IPC.gitClone, parentDir, url),commit: (cwd, message) => ipcRenderer.invoke(IPC.gitCommit, cwd, message),push: (cwd) => ipcRenderer.invoke(IPC.gitPush, cwd),pull: (cwd) => ipcRenderer.invoke(IPC.gitPull, cwd),@@ -55,6 +58,23 @@ const api: NodeTerminalApi = {switchBranch: (cwd, name) => ipcRenderer.invoke(IPC.gitSwitchBranch, cwd, name),createBranch: (cwd, name) => ipcRenderer.invoke(IPC.gitCreateBranch, cwd, name),generateMessage: (cwd) => ipcRenderer.invoke(IPC.commitGenerate, cwd)+ },+ clipboard: {+ writeText: (text: string) => clipboard.writeText(text)+ },+ shell: {+ reveal: (path: string) => ipcRenderer.send(IPC.shellReveal, path),+ openPath: (path: string) => ipcRenderer.send(IPC.shellOpenPath, path)+ },+ fs: {+ list: (dirPath: string) => ipcRenderer.invoke(IPC.fsList, dirPath),+ read: (filePath: string) => ipcRenderer.invoke(IPC.fsRead, filePath),+ write: (filePath: string, content: string) => ipcRenderer.invoke(IPC.fsWrite, filePath, content)+ },+ onMarkdownToggle: (listener) => {+ const handler = () => listener()+ ipcRenderer.on(IPC.appToggleMarkdown, handler)+ return () => ipcRenderer.removeListener(IPC.appToggleMarkdown, handler)}}diff --git a/src/renderer/assets/claude.svg b/src/renderer/assets/claude.svgnew file mode 100644index 000000000..ed1293c47--- /dev/null+++ b/src/renderer/assets/claude.svg@@ -0,0 +1 @@+<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Claude Code</title><path clip-rule="evenodd" d="M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z" fill="#D97757" fill-rule="evenodd"></path></svg>\ No newline at end of filediff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 937452af7..64e27a707 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -5,6 +5,7 @@ import {Controls,MiniMap,ReactFlow,+ SelectionMode,useNodesState,useReactFlow,type Viewport@@ -13,19 +14,45 @@ import type { Node } from '@xyflow/react'import { TerminalNode } from '../nodes/TerminalNode'import { StickyNode } from '../nodes/StickyNode'import { GroupNode } from '../nodes/GroupNode'+import { EditorNode } from '../nodes/EditorNode'import { Dock } from '../components/Dock'import { TabBar } from '../components/TabBar'import { ContextMenu, type MenuItem } from '../components/ContextMenu'import { CommandPalette, type Command } from '../components/CommandPalette'+import {+ IconClaude,+ IconCollapse,+ IconDuplicate,+ IconFit,+ IconGrid,+ IconGroup,+ IconJump,+ IconMarkdown,+ IconNote,+ IconProject,+ IconSave,+ IconSelectAll,+ IconSwitch,+ IconTerminal,+ IconTrash,+ IconUngroup+} from '../components/icons'import { SettingsPanel } from '../components/SettingsPanel'import { SourceControlPanel } from '../components/SourceControlPanel'+import { WelcomeScreen } from '../components/WelcomeScreen'+import { ShortcutsPanel } from '../components/ShortcutsPanel'+import { ConfirmDialog } from '../components/ConfirmDialog'+import { ExplorerPanel } from '../components/ExplorerPanel'import { transport } from '../terminal/local-transport'import { useProjects } from '../state/projects'import { useSettings } from '../state/settings'import {COLLAPSED_HEIGHT,+ createClaudeNode,+ createEditorNode,createStickyNode,createTerminalNode,+ duplicateNode,flowToNodeStates,groupSelectedNodes,nodeStatesToFlow,@@ -43,26 +70,44 @@ export function Canvas() {const [paletteOpen, setPaletteOpen] = useState(false)const [settingsOpen, setSettingsOpen] = useState(false)const [scOpen, setScOpen] = useState(false)+ const [shortcutsOpen, setShortcutsOpen] = useState(false)+ const [explorerOpen, setExplorerOpen] = useState(false)+ const [confirm, setConfirm] = useState<{ message: string; onConfirm: () => void } | null>(null)const settings = useSettings((s) => s.settings)const viewportRef = useRef<Viewport>({ x: 0, y: 0, zoom: 1 })const nodesRef = useRef<CanvasNode[]>(nodes)const loadingRef = useRef(false)const flowWrapRef = useRef<HTMLDivElement>(null)+ // Undo/redo history (snapshots of the nodes array; arrays are immutable per change).+ const pastRef = useRef<CanvasNode[][]>([])+ const futureRef = useRef<CanvasNode[][]>([])+ const committedRef = useRef<CanvasNode[]>([])+ const draggingRef = useRef(false)+ const [, bumpHist] = useState(0)const { setViewport, fitView, zoomIn, zoomOut, screenToFlowPosition, setCenter, getZoom } =useReactFlow()const activeProjectId = useProjects((s) => s.activeProjectId)+ const hasProjects = useProjects((s) => s.projects.length > 0)nodesRef.current = nodesconst nodeTypes = useMemo(- () => ({ terminal: TerminalNode, sticky: StickyNode, group: GroupNode }),+ () => ({ terminal: TerminalNode, sticky: StickyNode, group: GroupNode, editor: EditorNode }),[])// 1) Load the whole workspace once and hydrate the projects store.useEffect(() => {let cancelled = false- void useSettings.getState().hydrate()+ useSettings+ .getState()+ .hydrate()+ .then(() => {+ if (!useSettings.getState().settings.seenShortcuts) {+ setShortcutsOpen(true)+ useSettings.getState().update({ seenShortcuts: true })+ }+ })window.nodeTerminal.workspace.load().then((ws) => {if (cancelled) returnuseProjects.getState().hydrate(ws)@@ -80,7 +125,13 @@ export function Canvas() {const project = useProjects.getState().getProject(activeProjectId)if (!project) returnloadingRef.current = true- setNodes(nodeStatesToFlow(project.nodes))+ const flow = nodeStatesToFlow(project.nodes)+ setNodes(flow)+ // Reset history for the newly loaded project.+ committedRef.current = flow+ pastRef.current = []+ futureRef.current = []+ bumpHist((v) => v + 1)viewportRef.current = project.viewportsetViewport(project.viewport)setZoomPct(Math.round(project.viewport.zoom * 100))@@ -118,6 +169,63 @@ export function Canvas() {return () => clearTimeout(t)}, [dirty, persist])+ // Record an undo snapshot when the canvas settles (debounced; skips drag frames/loads).+ useEffect(() => {+ if (loadingRef.current) {+ committedRef.current = nodes+ return+ }+ if (draggingRef.current) return+ const t = setTimeout(() => {+ if (nodes !== committedRef.current) {+ pastRef.current.push(committedRef.current)+ if (pastRef.current.length > 100) pastRef.current.shift()+ futureRef.current = []+ committedRef.current = nodes+ bumpHist((v) => v + 1)+ }+ }, 300)+ return () => clearTimeout(t)+ }, [nodes])++ const undo = useCallback(() => {+ if (!pastRef.current.length) return+ const prev = pastRef.current.pop() as CanvasNode[]+ futureRef.current.push(committedRef.current)+ committedRef.current = prev+ nodesRef.current = prev+ setNodes(prev)+ setDirty(true)+ bumpHist((v) => v + 1)+ }, [setNodes])++ const redo = useCallback(() => {+ if (!futureRef.current.length) return+ const next = futureRef.current.pop() as CanvasNode[]+ pastRef.current.push(committedRef.current)+ committedRef.current = next+ nodesRef.current = next+ setNodes(next)+ setDirty(true)+ bumpHist((v) => v + 1)+ }, [setNodes])++ // Cmd/Ctrl+Z = undo, Cmd/Ctrl+Shift+Z or Cmd/Ctrl+Y = redo (ignored while typing).+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (!(e.metaKey || e.ctrlKey)) return+ const k = e.key.toLowerCase()+ if (k !== 'z' && k !== 'y') return+ const tag = (document.activeElement?.tagName || '').toLowerCase()+ if (tag === 'input' || tag === 'textarea') return+ e.preventDefault()+ if (k === 'y' || (k === 'z' && e.shiftKey)) redo()+ else undo()+ }+ window.addEventListener('keydown', onKey)+ return () => window.removeEventListener('keydown', onKey)+ }, [undo, redo])+// ---- canvas interactions ----const handleNodesChange: typeof onNodesChange = useCallback((changes) => {@@ -135,14 +243,46 @@ export function Canvas() {}, [screenToFlowPosition])const addTerminal = useCallback(- (center?: { x: number; y: number }) => {+ (center?: { x: number; y: number }, initialCommand?: string) => {const cwd = useProjects.getState().getProject(activeProjectId)?.cwd- setNodes((ns) => [...ns, createTerminalNode(ns.length, cwd, center ?? viewCenter())])+ setNodes((ns) => [+ ...ns,+ createTerminalNode(ns.length, cwd, center ?? viewCenter(), initialCommand)+ ])markDirty()},[setNodes, markDirty, activeProjectId, viewCenter])+ /** Open a new terminal that runs a command on start (e.g. gh auth login). */+ const runInTerminal = useCallback((cmd: string) => addTerminal(undefined, cmd), [addTerminal])++ /** Open a file as a code editor node on the canvas. */+ const openFile = useCallback(+ (filePath: string) => {+ setNodes((ns) => [...ns, createEditorNode(ns.length, filePath, viewCenter())])+ markDirty()+ },+ [setNodes, markDirty, viewCenter]+ )++ const cloneRepo = useCallback(async () => {+ const url = window.prompt('Repository URL (https:// or git@):')+ if (!url) return+ const parent = await window.nodeTerminal.dialog.selectFolder()+ if (!parent) return+ const r = await window.nodeTerminal.git.clone(parent, url)+ if (!r.ok) {+ window.alert(`Clone failed: ${r.message}`)+ return+ }+ const name = url.split('/').pop()?.replace(/\.git$/, '') || 'repo'+ commitActiveToStore()+ const project = useProjects.getState().addProject(name, r.message)+ useProjects.getState().setActive(project.id)+ void writeDisk()+ }, [commitActiveToStore, writeDisk])+const addSticky = useCallback((center?: { x: number; y: number }) => {setNodes((ns) => [...ns, createStickyNode(ns.length, center ?? viewCenter())])@@ -151,6 +291,34 @@ export function Canvas() {[setNodes, markDirty, viewCenter])+ const addClaude = useCallback(+ (center?: { x: number; y: number }) => {+ const cwd = useProjects.getState().getProject(activeProjectId)?.cwd+ setNodes((ns) => [...ns, createClaudeNode(ns.length, cwd, center ?? viewCenter())])+ markDirty()+ },+ [setNodes, markDirty, activeProjectId, viewCenter]+ )++ // ⌘T = new terminal, ⌘⇧C = new Claude Code (ignored while typing in a field/terminal).+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (!(e.metaKey || e.ctrlKey)) return+ const tag = (document.activeElement?.tagName || '').toLowerCase()+ if (tag === 'input' || tag === 'textarea') return+ const k = e.key.toLowerCase()+ if (k === 't' && !e.shiftKey) {+ e.preventDefault()+ addTerminal()+ } else if (k === 'c' && e.shiftKey) {+ e.preventDefault()+ addClaude()+ }+ }+ window.addEventListener('keydown', onKey)+ return () => window.removeEventListener('keydown', onKey)+ }, [addTerminal, addClaude])+// ---- multi-node actions (context menu) ----const deleteNodes = useCallback((ids: string[]) => {@@ -184,6 +352,27 @@ export function Canvas() {[setNodes, markDirty])+ // Delete / Backspace asks for confirmation, then deletes the selected nodes.+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (e.key !== 'Delete' && e.key !== 'Backspace') return+ const tag = (document.activeElement?.tagName || '').toLowerCase()+ if (tag === 'input' || tag === 'textarea') return+ const ids = nodesRef.current.filter((n) => n.selected).map((n) => n.id)+ if (!ids.length) return+ e.preventDefault()+ setConfirm({+ message: `Delete ${ids.length} ${ids.length > 1 ? 'nodes' : 'node'}? Open terminal sessions will end.`,+ onConfirm: () => {+ deleteNodes(ids)+ setConfirm(null)+ }+ })+ }+ window.addEventListener('keydown', onKey)+ return () => window.removeEventListener('keydown', onKey)+ }, [deleteNodes])+const groupSelection = useCallback((ids: string[]) => {const groupCount = nodesRef.current.filter((n) => n.type === 'group').length@@ -201,6 +390,32 @@ export function Canvas() {[setNodes, markDirty])+ const toggleMarkdown = useCallback(+ (ids: string[]) => {+ const set = new Set(ids)+ setNodes((ns) =>+ ns.map((n) =>+ set.has(n.id) && n.type === 'terminal'+ ? { ...n, data: { ...n.data, mdMode: !n.data.mdMode } }+ : n+ )+ )+ },+ [setNodes]+ )++ const duplicateNodes = useCallback(+ (ids: string[]) => {+ const set = new Set(ids)+ setNodes((ns) => {+ const copies = ns.filter((n) => set.has(n.id)).map((n) => duplicateNode(n))+ return [...ns.map((n) => ({ ...n, selected: false })), ...copies]+ })+ markDirty()+ },+ [setNodes, markDirty]+ )+const setNodesColor = useCallback((ids: string[], color: string) => {const set = new Set(ids)@@ -287,6 +502,18 @@ export function Canvas() {} else if ((e.metaKey || e.ctrlKey) && e.key === ',') {e.preventDefault()setSettingsOpen(true)+ } else if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key.toLowerCase() === 'e') {+ e.preventDefault()+ setExplorerOpen((v) => !v)+ } else if ((e.metaKey || e.ctrlKey) && e.key === '/') {+ e.preventDefault()+ setShortcutsOpen((v) => !v)+ } else if ((e.metaKey || e.ctrlKey) && !e.shiftKey && e.key.toLowerCase() === 'c') {+ // Copy the current page selection (e.g. markdown view) to the clipboard.+ const tag = (document.activeElement?.tagName || '').toLowerCase()+ if (tag === 'input' || tag === 'textarea') return+ const sel = window.getSelection?.()?.toString()+ if (sel) window.nodeTerminal.clipboard.writeText(sel)}}window.addEventListener('keydown', onKey)@@ -310,18 +537,32 @@ export function Canvas() {{ type: 'label', label: ids.length > 1 ? `${ids.length} nodes` : '1 node' },...(ids.length > 1? ([- { label: 'Group selection', onClick: () => groupSelection(ids) },+ { label: 'Group selection', icon: <IconGroup />, onClick: () => groupSelection(ids) },{ type: 'separator' }] as MenuItem[]): []),{ type: 'colors', onPick: (c) => setNodesColor(ids, c) },{ type: 'separator' },- { label: 'Align to grid', onClick: () => alignToGrid(ids) },- { label: 'Collapse / Expand', onClick: () => toggleCollapseNodes(ids) },+ { label: 'Duplicate', icon: <IconDuplicate />, onClick: () => duplicateNodes(ids) },+ { label: 'Align to grid', icon: <IconGrid />, onClick: () => alignToGrid(ids) },+ { label: 'Collapse / Expand', icon: <IconCollapse />, onClick: () => toggleCollapseNodes(ids) },+ ...(ids.some((nid) => nodesRef.current.find((n) => n.id === nid)?.type === 'terminal')+ ? ([+ { label: 'Markdown view', icon: <IconMarkdown />, onClick: () => toggleMarkdown(ids) }+ ] as MenuItem[])+ : []),{ type: 'separator' },- { label: 'Delete', danger: true, onClick: () => deleteNodes(ids) }+ { label: 'Delete', icon: <IconTrash />, danger: true, onClick: () => deleteNodes(ids) }],- [groupSelection, setNodesColor, alignToGrid, toggleCollapseNodes, deleteNodes]+ [+ groupSelection,+ setNodesColor,+ duplicateNodes,+ alignToGrid,+ toggleCollapseNodes,+ toggleMarkdown,+ deleteNodes+ ])const groupItems = useCallback(@@ -329,8 +570,8 @@ export function Canvas() {{ type: 'label', label: 'Group' },{ type: 'colors', onPick: (c) => setNodesColor([groupId], c) },{ type: 'separator' },- { label: 'Ungroup', onClick: () => ungroup(groupId) },- { label: 'Delete (keeps nodes)', danger: true, onClick: () => ungroup(groupId) }+ { label: 'Ungroup', icon: <IconUngroup />, onClick: () => ungroup(groupId) },+ { label: 'Delete (keeps nodes)', icon: <IconTrash />, danger: true, onClick: () => ungroup(groupId) }],[setNodesColor, ungroup])@@ -343,15 +584,16 @@ export function Canvas() {x: e.clientX,y: e.clientY,items: [- { label: 'New terminal here', onClick: () => addTerminal(at) },- { label: 'New sticky note here', onClick: () => addSticky(at) },+ { label: 'New terminal', icon: <IconTerminal />, onClick: () => addTerminal(at) },+ { label: 'New Claude Code', icon: <IconClaude />, onClick: () => addClaude(at) },+ { label: 'New sticky note', icon: <IconNote />, onClick: () => addSticky(at) },{ type: 'separator' },- { label: 'Select all', onClick: selectAll },- { label: 'Fit view', onClick: () => fitView({ padding: 0.2, duration: 300 }) }+ { label: 'Select all', icon: <IconSelectAll />, onClick: selectAll },+ { label: 'Fit view', icon: <IconFit />, onClick: () => fitView({ padding: 0.2, duration: 300 }) }]})},- [screenToFlowPosition, addTerminal, addSticky, selectAll, fitView]+ [screenToFlowPosition, addTerminal, addClaude, addSticky, selectAll, fitView])const onNodeContextMenu = useCallback(@@ -444,7 +686,6 @@ export function Canvas() {const deleteProject = useCallback((id: string) => {const store = useProjects.getState()- if (store.projects.length <= 1) returnif (id === store.activeProjectId) commitActiveToStore()// End the tmux sessions of every terminal in the deleted project.store.getProject(id)?.nodes.forEach((n) => {@@ -458,11 +699,12 @@ export function Canvas() {const buildCommands = useCallback((): Command[] => {const cmds: Command[] = [- { id: 'new-term', label: 'New terminal', section: 'Create', run: () => addTerminal() },- { id: 'new-sticky', label: 'New sticky note', run: () => addSticky() },- { id: 'new-project', label: 'New project', run: () => addProject() },- { id: 'fit', label: 'Fit view', run: () => fitView({ padding: 0.2, duration: 300 }) },- { id: 'save', label: 'Save', run: () => void persist() }+ { id: 'new-term', label: 'New terminal', section: 'Create', icon: <IconTerminal />, run: () => addTerminal() },+ { id: 'new-claude', label: 'New Claude Code', icon: <IconClaude />, run: () => addClaude() },+ { id: 'new-sticky', label: 'New sticky note', icon: <IconNote />, run: () => addSticky() },+ { id: 'new-project', label: 'New project', icon: <IconProject />, run: () => addProject() },+ { id: 'fit', label: 'Fit view', icon: <IconFit />, run: () => fitView({ padding: 0.2, duration: 300 }) },+ { id: 'save', label: 'Save', icon: <IconSave />, run: () => void persist() }]const store = useProjects.getState()store.projects@@ -472,6 +714,7 @@ export function Canvas() {id: `proj-${p.id}`,label: `Switch to ${p.name}`,hint: 'project',+ icon: <IconSwitch />,run: () => switchProject(p.id)}))@@ -482,11 +725,12 @@ export function Canvas() {id: `node-${n.id}`,label: `Go to ${n.data.title}`,hint: ((n.data.tags as string[]) ?? []).join(' '),+ icon: <IconJump />,run: () => goToNode(n)}))return cmds- }, [addTerminal, addSticky, addProject, fitView, persist, switchProject, goToNode])+ }, [addTerminal, addClaude, addSticky, addProject, fitView, persist, switchProject, goToNode])return (<div className="canvas-root">@@ -500,8 +744,16 @@ export function Canvas() {/><div className="controls-cluster">- <button title="Command palette (⌘K)" onClick={() => setPaletteOpen(true)}>- ⌕+ <button+ className="cluster-search"+ title="Command palette"+ onClick={() => setPaletteOpen(true)}+ >+ <span className="cluster-search__icon">⌕</span>+ <span className="kbd">⌘K</span>+ </button>+ <button title="Explorer (⌘⇧E)" onClick={() => setExplorerOpen(true)}>+ 🗂</button><button title="Source Control" onClick={() => setScOpen(true)}>⎇@@ -509,6 +761,9 @@ export function Canvas() {<button title="Settings (⌘,)" onClick={() => setSettingsOpen(true)}>⚙</button>+ <button title="Keyboard shortcuts (⌘/)" onClick={() => setShortcutsOpen(true)}>+ ?+ </button></div><div className="flow-wrap" ref={flowWrapRef}>@@ -517,6 +772,16 @@ export function Canvas() {nodeTypes={nodeTypes}onNodesChange={handleNodesChange}onMove={onMove}+ onNodeDragStart={() => (draggingRef.current = true)}+ onNodeDragStop={() => {+ draggingRef.current = false+ markDirty()+ }}+ onSelectionDragStart={() => (draggingRef.current = true)}+ onSelectionDragStop={() => {+ draggingRef.current = false+ markDirty()+ }}onPaneContextMenu={onPaneContextMenu}onNodeContextMenu={onNodeContextMenu}onSelectionContextMenu={onSelectionContextMenu}@@ -526,15 +791,19 @@ export function Canvas() {proOptions={{ hideAttribution: true }}deleteKeyCode={null}selectionOnDrag- panOnDrag={[1, 2]}+ selectionMode={SelectionMode.Partial}+ panOnDrag={[1]}+ panOnScroll+ zoomOnScroll={false}+ zoomOnPinchsnapToGrid={settings.snapToGrid}snapGrid={[settings.gridSize, settings.gridSize]}><Backgroundvariant={BackgroundVariant.Dots}gap={settings.gridSize || GRID}- size={1}- color="#3a3a3a"+ size={2.5}+ color="#4a4a4a"/><Controls showInteractive={false} position="bottom-left" /><MiniMap@@ -547,6 +816,14 @@ export function Canvas() {nodeStrokeColor={(n) => (n.data as { color?: string })?.color ?? '#0a84ff'}/></ReactFlow>++ {!hasProjects && (+ <WelcomeScreen+ onNewProject={addProject}+ onOpenFolder={addProjectFromFolder}+ onCloneRepo={cloneRepo}+ />+ )}</div>{menu && (@@ -559,13 +836,34 @@ export function Canvas() {{settingsOpen && <SettingsPanel onClose={() => setSettingsOpen(false)} />}- {scOpen && <SourceControlPanel onClose={() => setScOpen(false)} />}+ {scOpen && (+ <SourceControlPanel onClose={() => setScOpen(false)} onRunInTerminal={runInTerminal} />+ )}++ {shortcutsOpen && <ShortcutsPanel onClose={() => setShortcutsOpen(false)} />}++ {explorerOpen && (+ <ExplorerPanel onClose={() => setExplorerOpen(false)} onOpenFile={openFile} />+ )}++ {confirm && (+ <ConfirmDialog+ message={confirm.message}+ onConfirm={confirm.onConfirm}+ onCancel={() => setConfirm(null)}+ />+ )}<Dockdirty={dirty}zoomPct={zoomPct}+ canUndo={pastRef.current.length > 0}+ canRedo={futureRef.current.length > 0}+ onUndo={undo}+ onRedo={redo}onAddTerminal={addTerminal}onAddSticky={addSticky}+ onAddClaude={addClaude}onSave={persist}onFitView={() => fitView({ padding: 0.2, duration: 300 })}onZoomIn={() => zoomIn({ duration: 150 })}diff --git a/src/renderer/components/CommandPalette.tsx b/src/renderer/components/CommandPalette.tsxindex d133f1c9a..c91d186bf 100644--- a/src/renderer/components/CommandPalette.tsx+++ b/src/renderer/components/CommandPalette.tsx@@ -1,4 +1,4 @@-import { useMemo, useState } from 'react'+import { useMemo, useState, type ReactNode } from 'react'import { createPortal } from 'react-dom'export interface Command {@@ -6,6 +6,7 @@ export interface Command {label: stringhint?: stringsection?: string+ icon?: ReactNoderun: () => void}@@ -80,6 +81,7 @@ export function CommandPalette({ commands, onClose }: CommandPaletteProps) {onMouseEnter={() => setActive(i)}onClick={() => run(c)}>+ <span className="palette__icon">{c.icon}</span><span className="palette__label">{c.label}</span>{c.hint && <span className="palette__hint">{c.hint}</span>}</button>diff --git a/src/renderer/components/ConfirmDialog.tsx b/src/renderer/components/ConfirmDialog.tsxnew file mode 100644index 000000000..557f0996a--- /dev/null+++ b/src/renderer/components/ConfirmDialog.tsx@@ -0,0 +1,54 @@+import { useEffect } from 'react'+import { createPortal } from 'react-dom'++interface ConfirmDialogProps {+ message: string+ confirmLabel?: string+ danger?: boolean+ onConfirm: () => void+ onCancel: () => void+}++/** A small themed confirm dialog. Enter confirms, Esc cancels. */+export function ConfirmDialog({+ message,+ confirmLabel = 'Delete',+ danger = true,+ onConfirm,+ onCancel+}: ConfirmDialogProps) {+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (e.key === 'Escape') {+ e.preventDefault()+ onCancel()+ } else if (e.key === 'Enter') {+ e.preventDefault()+ onConfirm()+ }+ }+ window.addEventListener('keydown', onKey)+ return () => window.removeEventListener('keydown', onKey)+ }, [onConfirm, onCancel])++ return createPortal(+ <div className="confirm-overlay" onClick={onCancel}>+ <div className="confirm" onClick={(e) => e.stopPropagation()}>+ <p className="confirm__msg">{message}</p>+ <div className="confirm__actions">+ <button className="confirm__btn" onClick={onCancel}>+ Cancel+ </button>+ <button+ className={`confirm__btn${danger ? ' danger' : ' primary'}`}+ autoFocus+ onClick={onConfirm}+ >+ {confirmLabel}+ </button>+ </div>+ </div>+ </div>,+ document.body+ )+}diff --git a/src/renderer/components/ContextMenu.tsx b/src/renderer/components/ContextMenu.tsxindex e5e2ae962..70daef231 100644--- a/src/renderer/components/ContextMenu.tsx+++ b/src/renderer/components/ContextMenu.tsx@@ -1,8 +1,16 @@+import type { ReactNode } from 'react'import { createPortal } from 'react-dom'import { NODE_COLORS } from '../state/workspace'export type MenuItem =- | { type?: 'item'; label: string; onClick: () => void; danger?: boolean; disabled?: boolean }+ | {+ type?: 'item'+ label: string+ onClick: () => void+ icon?: ReactNode+ danger?: boolean+ disabled?: boolean+ }| { type: 'separator' }| { type: 'label'; label: string }| { type: 'colors'; onPick: (color: string) => void }@@ -52,6 +60,7 @@ export function ContextMenu({ x, y, items, onClose }: ContextMenuProps) {onClose()}}>+ <span className="ctx-icon">{item.icon}</span>{item.label}</button>)diff --git a/src/renderer/components/Dock.tsx b/src/renderer/components/Dock.tsxindex 4cae00b99..26cbc3281 100644--- a/src/renderer/components/Dock.tsx+++ b/src/renderer/components/Dock.tsx@@ -1,10 +1,16 @@import { useState } from 'react'+import claudeIcon from '../assets/claude.svg'interface DockProps {dirty: booleanzoomPct: number+ canUndo: boolean+ canRedo: booleanonAddTerminal: () => voidonAddSticky: () => void+ onAddClaude: () => void+ onUndo: () => void+ onRedo: () => voidonSave: () => voidonFitView: () => voidonZoomIn: () => void@@ -18,8 +24,13 @@ interface DockProps {export function Dock({dirty,zoomPct,+ canUndo,+ canRedo,onAddTerminal,onAddSticky,+ onAddClaude,+ onUndo,+ onRedo,onSave,onFitView,onZoomIn,@@ -43,6 +54,10 @@ export function Dock({<TerminalIcon /><span>Terminal</span></button>+ <button onClick={pick(onAddClaude)}>+ <ClaudeIcon />+ <span>Claude Code</span>+ </button><button onClick={pick(onAddSticky)}><NoteIcon /><span>Sticky Note</span>@@ -60,6 +75,15 @@ export function Dock({<span className="dock-sep" />+ <button className="dock-btn" title="Undo (⌘Z)" disabled={!canUndo} onClick={onUndo}>+ <UndoIcon />+ </button>+ <button className="dock-btn" title="Redo (⌘⇧Z)" disabled={!canRedo} onClick={onRedo}>+ <RedoIcon />+ </button>++ <span className="dock-sep" />+<button className="dock-btn" title="Save" onClick={onSave}><SaveIcon /><span className={`dock-dirty${dirty ? ' dirty' : ''}`} />@@ -92,6 +116,20 @@ function PlusIcon() {</svg>)}+function UndoIcon() {+ return (+ <svg {...S}>+ <path d="M9 7L4 12l5 5M4 12h11a5 5 0 0 1 0 10h-2" />+ </svg>+ )+}+function RedoIcon() {+ return (+ <svg {...S}>+ <path d="M15 7l5 5-5 5M20 12H9a5 5 0 0 0 0 10h2" />+ </svg>+ )+}function PlusSmallIcon() {return (<svg {...S} width={15} height={15}>@@ -137,3 +175,6 @@ function NoteIcon() {</svg>)}+function ClaudeIcon() {+ return <img src={claudeIcon} width={18} height={18} alt="Claude Code" style={{ display: 'block' }} />+}diff --git a/src/renderer/components/ExplorerPanel.tsx b/src/renderer/components/ExplorerPanel.tsxnew file mode 100644index 000000000..77af7720b--- /dev/null+++ b/src/renderer/components/ExplorerPanel.tsx@@ -0,0 +1,178 @@+import { useCallback, useEffect, useState } from 'react'+import { createPortal } from 'react-dom'+import type { DirEntry } from '@shared/types'+import { useProjects } from '../state/projects'++interface ExplorerPanelProps {+ onClose: () => void+ onOpenFile: (path: string) => void+}++type ContextFn = (x: number, y: number, path: string, isDir: boolean) => void+type OpenFn = (path: string) => void++function EntryIcon({ dir }: { dir: boolean }) {+ return dir ? (+ <svg className="ex-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6">+ <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />+ </svg>+ ) : (+ <svg className="ex-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6">+ <path d="M6 3h8l4 4v14H6z" />+ <path d="M14 3v4h4" />+ </svg>+ )+}++function TreeEntry({+ entry,+ path,+ depth,+ onContext,+ onOpenFile+}: {+ entry: DirEntry+ path: string+ depth: number+ onContext: ContextFn+ onOpenFile: OpenFn+}) {+ const [open, setOpen] = useState(false)+ const [children, setChildren] = useState<DirEntry[] | null>(null)++ const onClick = useCallback(async () => {+ if (!entry.dir) {+ onOpenFile(path)+ return+ }+ const next = !open+ setOpen(next)+ if (next && children === null) setChildren(await window.nodeTerminal.fs.list(path))+ }, [entry.dir, open, children, path, onOpenFile])++ return (+ <>+ <div+ className="ex-row"+ style={{ paddingLeft: 8 + depth * 14 }}+ onClick={onClick}+ onContextMenu={(e) => {+ e.preventDefault()+ onContext(e.clientX, e.clientY, path, entry.dir)+ }}+ title={entry.name}+ >+ <span className={`ex-chevron${entry.dir ? '' : ' hidden'}${open ? ' open' : ''}`}>›</span>+ <EntryIcon dir={entry.dir} />+ <span className="ex-name">{entry.name}</span>+ </div>+ {entry.dir &&+ open &&+ children?.map((c) => (+ <TreeEntry+ key={c.name}+ entry={c}+ path={`${path}/${c.name}`}+ depth={depth + 1}+ onContext={onContext}+ onOpenFile={onOpenFile}+ />+ ))}+ </>+ )+}++/** Project file explorer — a lazy-loaded tree of the active project's folder. */+export function ExplorerPanel({ onClose, onOpenFile }: ExplorerPanelProps) {+ const project = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId))+ const cwd = project?.cwd+ const [roots, setRoots] = useState<DirEntry[] | null>(null)+ const [version, setVersion] = useState(0)+ const [menu, setMenu] = useState<{ x: number; y: number; path: string } | null>(null)++ useEffect(() => {+ if (cwd) window.nodeTerminal.fs.list(cwd).then(setRoots)+ else setRoots(null)+ }, [cwd, version])++ const onContext: ContextFn = (x, y, path) => setMenu({ x, y, path })++ return createPortal(+ <div className="drawer-overlay" onClick={onClose}>+ <aside className="drawer" onClick={(e) => e.stopPropagation()}>+ <div className="drawer__head">+ <h2>{project?.name || 'Explorer'}</h2>+ <div className="ex-head-actions">+ <button title="Refresh" onClick={() => setVersion((v) => v + 1)}>+ ↻+ </button>+ <button className="drawer__close" onClick={onClose}>+ ×+ </button>+ </div>+ </div>++ {!cwd && (+ <div className="drawer__body">+ <p className="set-note">Set a folder for this project first (tab ⌄ → “Set folder…”).</p>+ </div>+ )}++ {cwd && (+ <div className="drawer__body ex-body">+ {roots?.length === 0 && <p className="set-note">Empty folder.</p>}+ {roots?.map((e) => (+ <TreeEntry+ key={e.name}+ entry={e}+ path={`${cwd}/${e.name}`}+ depth={0}+ onContext={onContext}+ onOpenFile={onOpenFile}+ />+ ))}+ </div>+ )}+ </aside>++ {menu &&+ createPortal(+ <>+ <div className="tab-backdrop" style={{ zIndex: 78 }} onClick={() => setMenu(null)} />+ <div className="ctx-menu" style={{ top: menu.y, left: menu.x, zIndex: 80 }}>+ <button+ className="ctx-item"+ onClick={() => {+ window.nodeTerminal.clipboard.writeText(menu.path)+ setMenu(null)+ }}+ >+ Copy Path+ </button>+ <button+ className="ctx-item"+ onClick={() => {+ window.nodeTerminal.clipboard.writeText(cwd ? menu.path.slice(cwd.length + 1) : menu.path)+ setMenu(null)+ }}+ >+ Copy Relative Path+ </button>+ <div className="ctx-sep" />+ <button+ className="ctx-item"+ onClick={() => {+ window.nodeTerminal.shell.reveal(menu.path)+ setMenu(null)+ }}+ >+ Reveal in Finder+ </button>+ </div>+ </>,+ document.body+ )}+ </div>,+ document.body+ )+}diff --git a/src/renderer/components/ShortcutsPanel.tsx b/src/renderer/components/ShortcutsPanel.tsxnew file mode 100644index 000000000..a2e40075d--- /dev/null+++ b/src/renderer/components/ShortcutsPanel.tsx@@ -0,0 +1,94 @@+import { useEffect } from 'react'+import { createPortal } from 'react-dom'++interface ShortcutsPanelProps {+ onClose: () => void+}++interface Row {+ keys: string[]+ label: string+}++const SECTIONS: { title: string; rows: Row[] }[] = [+ {+ title: 'General',+ rows: [+ { keys: ['⌘', 'K'], label: 'Command palette' },+ { keys: ['⌘', ','], label: 'Settings' },+ { keys: ['⌘', '/'], label: 'This shortcuts panel' },+ { keys: ['⌘', 'Z'], label: 'Undo' },+ { keys: ['⌘', '⇧', 'Z'], label: 'Redo' }+ ]+ },+ {+ title: 'Canvas',+ rows: [+ { keys: ['⌘', 'T'], label: 'New terminal' },+ { keys: ['⌘', '⇧', 'C'], label: 'New Claude Code' },+ { keys: ['Right-click'], label: 'Actions menu (empty space or node)' },+ { keys: ['Left-drag'], label: 'Box-select (touch to select)' },+ { keys: ['Middle / Right-drag'], label: 'Pan the canvas' },+ { keys: ['Double-click'], label: 'Center & focus a node' },+ { keys: ['⌘', 'wheel'], label: 'Zoom in / out' }+ ]+ },+ {+ title: 'Terminal',+ rows: [+ { keys: ['Hover ~0.6s'], label: 'Enter the terminal (type/select)' },+ { keys: ['Quick drag'], label: 'Move the terminal (before it focuses)' },+ { keys: ['⌘', 'M'], label: 'Toggle markdown view' },+ { keys: ['⌘', 'C'], label: 'Copy selection (markdown view)' },+ { keys: ['✦'], label: 'Name the terminal with AI' }+ ]+ },+ {+ title: 'Source Control',+ rows: [{ keys: ['⌘', '↵'], label: 'Commit the staged changes' }]+ }+]++/** Keyboard shortcuts reference; shown on first launch and via ⌘/ or the ? button. */+export function ShortcutsPanel({ onClose }: ShortcutsPanelProps) {+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (e.key === 'Escape') onClose()+ }+ window.addEventListener('keydown', onKey)+ return () => window.removeEventListener('keydown', onKey)+ }, [onClose])++ return createPortal(+ <div className="sc-overlay" onClick={onClose}>+ <div className="shortcuts" onClick={(e) => e.stopPropagation()}>+ <div className="shortcuts__head">+ <h2>Keyboard shortcuts</h2>+ <button className="drawer__close" onClick={onClose}>+ ×+ </button>+ </div>+ <div className="shortcuts__body">+ {SECTIONS.map((s) => (+ <section key={s.title}>+ <h3>{s.title}</h3>+ {s.rows.map((r) => (+ <div key={r.label} className="shortcut-row">+ <span className="shortcut-label">{r.label}</span>+ <span className="shortcut-keys">+ {r.keys.map((k, i) => (+ <kbd key={i} className="kbd">+ {k}+ </kbd>+ ))}+ </span>+ </div>+ ))}+ </section>+ ))}+ </div>+ </div>+ </div>,+ document.body+ )+}diff --git a/src/renderer/components/SourceControlPanel.tsx b/src/renderer/components/SourceControlPanel.tsxindex dfcb745ef..abec0bd8a 100644--- a/src/renderer/components/SourceControlPanel.tsx+++ b/src/renderer/components/SourceControlPanel.tsx@@ -5,6 +5,7 @@ import { useProjects } from '../state/projects'interface SourceControlPanelProps {onClose: () => void+ onRunInTerminal: (cmd: string) => void}const STATUS_COLOR: Record<string, string> = {@@ -48,7 +49,7 @@ function DiffBlock({ text }: { text: string }) {}/** Visual Studio-style Source Control: file-level stage/diff/discard + branch switcher. */-export function SourceControlPanel({ onClose }: SourceControlPanelProps) {+export function SourceControlPanel({ onClose, onRunInTerminal }: SourceControlPanelProps) {const project = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId))const cwd = project?.cwdconst [status, setStatus] = useState<GitStatus | null>(null)@@ -60,6 +61,7 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {const [branchMenu, setBranchMenu] = useState<{ top: number; left: number } | null>(null)const [newBranch, setNewBranch] = useState('')const [generating, setGenerating] = useState(false)+ const [fileMenu, setFileMenu] = useState<{ x: number; y: number; path: string } | null>(null)const git = window.nodeTerminal.git@@ -119,7 +121,13 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {const key = `${staged ? 's' : 'c'}:${f.path}`return (<Fragment key={key}>- <div className={`scm-file${openKey === key ? ' open' : ''}`}>+ <div+ className={`scm-file${openKey === key ? ' open' : ''}`}+ onContextMenu={(e) => {+ e.preventDefault()+ setFileMenu({ x: e.clientX, y: e.clientY, path: f.path })+ }}+ ><span className="scm-letter" style={{ color: STATUS_COLOR[f.status] ?? 'rgba(255,255,255,0.85)' }}>{f.status}</span>@@ -201,8 +209,14 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {) : (<buttonclassName="scm-sync"- disabled={busy || !status.ghAvailable}- title={status.ghAvailable ? '' : 'GitHub CLI (gh) not found'}+ disabled={busy || !status.ghAuthed}+ title={+ !status.ghAvailable+ ? 'GitHub CLI (gh) not found'+ : !status.ghAuthed+ ? 'Sign in to GitHub first'+ : ''+ }onClick={() => act(() => git.publish(cwd, project?.name || 'repo', true))}>Publish@@ -211,32 +225,19 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {</div><div className="drawer__body scm-body">- {status.staged.length > 0 && (- <section className="scm-section">- <div className="scm-section-head">- <span>- STAGED · <b>{status.staged.length}</b>- </span>- <button onClick={() => act(() => git.unstageAll(cwd))}>unstage all</button>- </div>- {renderFiles(status.staged, true)}- </section>- )}-- <section className="scm-section">- <div className="scm-section-head">- <span>- CHANGES · <b>{status.changes.length}</b>- </span>- {status.changes.length > 0 && (- <button onClick={() => act(() => git.stageAll(cwd))}>+ stage all</button>- )}+ {status.ghAvailable && !status.ghAuthed && (+ <div className="scm-signin">+ <span>Not signed in to GitHub.</span>+ <button+ onClick={() => {+ onRunInTerminal('gh auth login')+ onClose()+ }}+ >+ Sign in to GitHub+ </button></div>- {status.changes.length === 0 && status.staged.length === 0 && (- <p className="set-note">No changes — working tree clean.</p>- )}- {renderFiles(status.changes, false)}- </section>+ )}<section className="scm-commit"><div className="scm-commit-head">@@ -272,6 +273,33 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {</button></section>+ {status.staged.length > 0 && (+ <section className="scm-section">+ <div className="scm-section-head">+ <span>+ STAGED · <b>{status.staged.length}</b>+ </span>+ <button onClick={() => act(() => git.unstageAll(cwd))}>unstage all</button>+ </div>+ {renderFiles(status.staged, true)}+ </section>+ )}++ <section className="scm-section">+ <div className="scm-section-head">+ <span>+ CHANGES · <b>{status.changes.length}</b>+ </span>+ {status.changes.length > 0 && (+ <button onClick={() => act(() => git.stageAll(cwd))}>+ stage all</button>+ )}+ </div>+ {status.changes.length === 0 && status.staged.length === 0 && (+ <p className="set-note">No changes — working tree clean.</p>+ )}+ {renderFiles(status.changes, false)}+ </section>+{status.recent.length > 0 && (<section className="scm-section"><div className="scm-section-head">@@ -298,8 +326,15 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {status &&createPortal(<>- <div className="tab-backdrop" onClick={() => setBranchMenu(null)} />- <div className="tab-menu" style={{ top: branchMenu.top, left: branchMenu.left }}>+ <div+ className="tab-backdrop"+ style={{ zIndex: 78 }}+ onClick={() => setBranchMenu(null)}+ />+ <div+ className="tab-menu"+ style={{ top: branchMenu.top, left: branchMenu.left, zIndex: 80 }}+ >{status.branches.map((b) => (<buttonkey={b}@@ -333,6 +368,44 @@ export function SourceControlPanel({ onClose }: SourceControlPanelProps) {document.body)}</aside>++ {fileMenu &&+ createPortal(+ <>+ <div className="tab-backdrop" style={{ zIndex: 78 }} onClick={() => setFileMenu(null)} />+ <div className="ctx-menu" style={{ top: fileMenu.y, left: fileMenu.x, zIndex: 80 }}>+ <button+ className="ctx-item"+ onClick={() => {+ window.nodeTerminal.clipboard.writeText(`${cwd}/${fileMenu.path}`)+ setFileMenu(null)+ }}+ >+ Copy Path+ </button>+ <button+ className="ctx-item"+ onClick={() => {+ window.nodeTerminal.clipboard.writeText(fileMenu.path)+ setFileMenu(null)+ }}+ >+ Copy Relative Path+ </button>+ <div className="ctx-sep" />+ <button+ className="ctx-item"+ onClick={() => {+ window.nodeTerminal.shell.reveal(`${cwd}/${fileMenu.path}`)+ setFileMenu(null)+ }}+ >+ Reveal in Finder+ </button>+ </div>+ </>,+ document.body+ )}</div>,document.body)diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsxindex e5424f78a..06c1bf741 100644--- a/src/renderer/components/TabBar.tsx+++ b/src/renderer/components/TabBar.tsx@@ -73,7 +73,29 @@ export function TabBar({)}<div className="tabbar">- <span className="tabbar__brand">node-terminal</span>+ <div className="brand">+ <svg className="brand__mark" viewBox="0 0 48 48" width="26" height="26" aria-hidden="true">+ <defs>+ <linearGradient id="ntg" x1="0" y1="0" x2="1" y2="1">+ <stop offset="0" stopColor="#a38dff" />+ <stop offset="1" stopColor="#622994" />+ </linearGradient>+ </defs>+ <path+ d="M13 12 L31 24 L13 36"+ fill="none"+ stroke="url(#ntg)"+ strokeWidth="5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <circle cx="13" cy="12" r="3.6" fill="#a38dff" />+ <circle cx="13" cy="36" r="3.6" fill="#a38dff" />+ <circle cx="31" cy="24" r="3.6" fill="#fff" />+ <rect x="33.5" y="32.5" width="10.5" height="5" rx="2.5" fill="#a38dff" />+ </svg>+ <span className="brand__name">nodeterm</span>+ </div><div className="tabbar__tabs">{projects.map((p) => {@@ -82,11 +104,14 @@ export function TabBar({<divkey={p.id}className={`tab${active ? ' active' : ''}`}- style={active ? { borderBottomColor: p.color } : undefined}+ style={active ? { color: p.color } : undefined}onClick={() => !editingId && onSwitch(p.id)}title={p.cwd || undefined}>- <span className="tab__dot" style={{ background: p.color }} />+ <span+ className="tab__dot"+ style={{ background: active ? p.color : 'rgba(255,255,255,0.3)' }}+ />{editingId === p.id ? (<inputclassName="tab__edit"@@ -185,7 +210,6 @@ export function TabBar({</button><buttonclassName="danger"- disabled={projects.length <= 1}onClick={() => {onDelete(menuProject.id)closeMenu()diff --git a/src/renderer/components/Tooltip.tsx b/src/renderer/components/Tooltip.tsxnew file mode 100644index 000000000..fe3aace83--- /dev/null+++ b/src/renderer/components/Tooltip.tsx@@ -0,0 +1,41 @@+import { useRef, useState, type ReactNode } from 'react'+import { createPortal } from 'react-dom'++interface TooltipProps {+ label: string+ children: ReactNode+ delay?: number+}++/** A custom styled tooltip (portal, fixed-positioned) shown on hover after a short delay. */+export function Tooltip({ label, children, delay = 350 }: TooltipProps) {+ const [pos, setPos] = useState<{ x: number; y: number } | null>(null)+ const timer = useRef<ReturnType<typeof setTimeout> | null>(null)++ const show = (e: React.MouseEvent) => {+ const el = e.currentTarget as HTMLElement+ if (timer.current) clearTimeout(timer.current)+ timer.current = setTimeout(() => {+ const r = el.getBoundingClientRect()+ setPos({ x: r.left + r.width / 2, y: r.bottom + 6 })+ }, delay)+ }++ const hide = () => {+ if (timer.current) clearTimeout(timer.current)+ setPos(null)+ }++ return (+ <span className="tooltip-trigger nodrag" onMouseEnter={show} onMouseLeave={hide} onMouseDown={hide}>+ {children}+ {pos &&+ createPortal(+ <div className="tooltip" style={{ left: pos.x, top: pos.y }}>+ {label}+ </div>,+ document.body+ )}+ </span>+ )+}diff --git a/src/renderer/components/WelcomeScreen.tsx b/src/renderer/components/WelcomeScreen.tsxnew file mode 100644index 000000000..e440cc2de--- /dev/null+++ b/src/renderer/components/WelcomeScreen.tsx@@ -0,0 +1,62 @@+interface WelcomeScreenProps {+ onNewProject: () => void+ onOpenFolder: () => void+ onCloneRepo: () => void+}++/** Shown when there are no projects — a start screen with quick actions. */+export function WelcomeScreen({ onNewProject, onOpenFolder, onCloneRepo }: WelcomeScreenProps) {+ return (+ <div className="welcome">+ <div className="welcome__brand">+ <svg viewBox="0 0 48 48" width="40" height="40" aria-hidden="true">+ <defs>+ <linearGradient id="wtg" x1="0" y1="0" x2="1" y2="1">+ <stop offset="0" stopColor="#a38dff" />+ <stop offset="1" stopColor="#622994" />+ </linearGradient>+ </defs>+ <path+ d="M13 12 L31 24 L13 36"+ fill="none"+ stroke="url(#wtg)"+ strokeWidth="5"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <circle cx="13" cy="12" r="3.6" fill="#a38dff" />+ <circle cx="13" cy="36" r="3.6" fill="#a38dff" />+ <circle cx="31" cy="24" r="3.6" fill="#fff" />+ <rect x="33.5" y="32.5" width="10.5" height="5" rx="2.5" fill="#a38dff" />+ </svg>+ <span className="welcome__name">nodeterm</span>+ </div>+ <p className="welcome__tagline">A canvas of terminals. Start a project to begin.</p>++ <div className="welcome__cards">+ <button className="welcome__card" onClick={onNewProject}>+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">+ <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />+ <path d="M12 11v5M9.5 13.5h5" />+ </svg>+ <span>New project</span>+ </button>++ <button className="welcome__card" onClick={onOpenFolder}>+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">+ <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />+ </svg>+ <span>Open folder…</span>+ </button>++ <button className="welcome__card" onClick={onCloneRepo}>+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round">+ <path d="M12 3v10M8 9l4 4 4-4" />+ <path d="M5 17v2a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-2" />+ </svg>+ <span>Clone repo…</span>+ </button>+ </div>+ </div>+ )+}diff --git a/src/renderer/components/icons.tsx b/src/renderer/components/icons.tsxnew file mode 100644index 000000000..ffc8f5e3d--- /dev/null+++ b/src/renderer/components/icons.tsx@@ -0,0 +1,147 @@+import claudeIcon from '../assets/claude.svg'++/** Small line icons (stroke = currentColor), shared across menus and the palette. */+const S = {+ width: 16,+ height: 16,+ viewBox: '0 0 24 24',+ fill: 'none',+ stroke: 'currentColor',+ strokeWidth: 1.8,+ strokeLinecap: 'round' as const,+ strokeLinejoin: 'round' as const+}++export const IconTerminal = () => (+ <svg {...S}>+ <rect x="3" y="4" width="18" height="16" rx="2" />+ <path d="M7 9l3 3-3 3M13 15h4" />+ </svg>+)++export const IconNote = () => (+ <svg {...S}>+ <path d="M4 4h16v11l-5 5H4z" />+ <path d="M20 15h-5v5" />+ </svg>+)++export const IconPlus = () => (+ <svg {...S}>+ <path d="M12 5v14M5 12h14" />+ </svg>+)++export const IconSelectAll = () => (+ <svg {...S}>+ <path d="M4 8V6a2 2 0 0 1 2-2h2M16 4h2a2 2 0 0 1 2 2v2M20 16v2a2 2 0 0 1-2 2h-2M8 20H6a2 2 0 0 1-2-2v-2" />+ </svg>+)++export const IconFit = () => (+ <svg {...S}>+ <path d="M4 9V5a1 1 0 0 1 1-1h4M15 4h4a1 1 0 0 1 1 1v4M20 15v4a1 1 0 0 1-1 1h-4M9 20H5a1 1 0 0 1-1-1v-4" />+ </svg>+)++export const IconColor = () => (+ <svg {...S}>+ <circle cx="12" cy="12" r="8" />+ <circle cx="9" cy="10" r="1.2" fill="currentColor" stroke="none" />+ <circle cx="15" cy="10" r="1.2" fill="currentColor" stroke="none" />+ <circle cx="12" cy="15" r="1.2" fill="currentColor" stroke="none" />+ </svg>+)++export const IconGrid = () => (+ <svg {...S}>+ <path d="M4 9h16M4 15h16M9 4v16M15 4v16" />+ </svg>+)++export const IconCollapse = () => (+ <svg {...S}>+ <path d="M8 4v4H4M16 4v4h4M8 20v-4H4M16 20v-4h4" />+ </svg>+)++export const IconGroup = () => (+ <svg {...S}>+ <rect x="3" y="3" width="18" height="18" rx="2" strokeDasharray="3 3" />+ <rect x="7" y="7" width="4" height="4" rx="1" />+ <rect x="13" y="13" width="4" height="4" rx="1" />+ </svg>+)++export const IconUngroup = () => (+ <svg {...S}>+ <rect x="4" y="4" width="9" height="9" rx="1.5" />+ <rect x="12" y="12" width="8" height="8" rx="1.5" strokeDasharray="3 3" />+ </svg>+)++export const IconTrash = () => (+ <svg {...S}>+ <path d="M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M6 7l1 13h10l1-13" />+ </svg>+)++export const IconProject = () => (+ <svg {...S}>+ <path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />+ </svg>+)++export const IconSwitch = () => (+ <svg {...S}>+ <path d="M7 7h11l-3-3M17 17H6l3 3" />+ </svg>+)++export const IconJump = () => (+ <svg {...S}>+ <circle cx="11" cy="11" r="7" />+ <path d="M11 8v6M8 11h6" />+ </svg>+)++export const IconSettings = () => (+ <svg {...S}>+ <circle cx="12" cy="12" r="3" />+ <path d="M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1" />+ </svg>+)++export const IconBranch = () => (+ <svg {...S}>+ <circle cx="6" cy="6" r="2.5" />+ <circle cx="6" cy="18" r="2.5" />+ <circle cx="18" cy="8" r="2.5" />+ <path d="M6 8.5v7M6 13a6 6 0 0 0 6-6h3.5" />+ </svg>+)++export const IconClaude = () => (+ <img src={claudeIcon} width={16} height={16} alt="Claude Code" style={{ display: 'block' }} />+)++export const IconMarkdown = () => (+ <svg {...S}>+ <rect x="3" y="5" width="18" height="14" rx="2" />+ <path d="M6 15V9l3 3 3-3v6M16.5 9v5M14.5 12l2 2 2-2" />+ </svg>+)++export const IconDuplicate = () => (+ <svg {...S}>+ <rect x="8" y="8" width="12" height="12" rx="2" />+ <path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" />+ </svg>+)++export const IconSave = () => (+ <svg {...S}>+ <path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />+ <path d="M17 21v-8H7v8M7 3v5h8" />+ </svg>+)diff --git a/src/renderer/editor/monaco-setup.ts b/src/renderer/editor/monaco-setup.tsnew file mode 100644index 000000000..f0ac92c97--- /dev/null+++ b/src/renderer/editor/monaco-setup.ts@@ -0,0 +1,19 @@+import * as monaco from 'monaco-editor'+import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'+import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'+import CssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'+import HtmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'+import TsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'++// Bundle Monaco's language workers locally (no CDN) so it works offline in Electron.+self.MonacoEnvironment = {+ getWorker(_workerId: string, label: string) {+ if (label === 'json') return new JsonWorker()+ if (label === 'css' || label === 'scss' || label === 'less') return new CssWorker()+ if (label === 'html' || label === 'handlebars' || label === 'razor') return new HtmlWorker()+ if (label === 'typescript' || label === 'javascript') return new TsWorker()+ return new EditorWorker()+ }+}++export { monaco }diff --git a/src/renderer/index.html b/src/renderer/index.htmlindex 43b6e41c7..8402a6ce4 100644--- a/src/renderer/index.html+++ b/src/renderer/index.html@@ -5,7 +5,7 @@<meta name="viewport" content="width=device-width, initial-scale=1.0" /><metahttp-equiv="Content-Security-Policy"- content="default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self'"+ content="default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self'; worker-src 'self' blob:; font-src 'self' data:"/><title>node-terminal</title></head>diff --git a/src/renderer/nodes/EditorNode.tsx b/src/renderer/nodes/EditorNode.tsxnew file mode 100644index 000000000..173a25e14--- /dev/null+++ b/src/renderer/nodes/EditorNode.tsx@@ -0,0 +1,101 @@+import { useEffect, useRef, useState } from 'react'+import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'+import { monaco } from '../editor/monaco-setup'+import { useSettings } from '../state/settings'+import type { CanvasNode } from '../state/workspace'++/**+ * A code editor node backed by Monaco. Reads the file on mount, auto-detects the language+ * from the path, and saves back with ⌘S (or the Save button).+ */+export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {+ const { deleteElements } = useReactFlow()+ const bodyRef = useRef<HTMLDivElement>(null)+ const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null)+ const savedRef = useRef<string>('')+ const [dirty, setDirty] = useState(false)+ const filePath = (data.filePath as string) ?? ''+ const fileName = filePath.split('/').pop() || 'untitled'++ const save = () => {+ const editor = editorRef.current+ if (!editor) return+ const value = editor.getValue()+ window.nodeTerminal.fs.write(filePath, value).then((ok) => {+ if (ok) {+ savedRef.current = value+ setDirty(false)+ }+ })+ }+ const saveRef = useRef(save)+ saveRef.current = save++ useEffect(() => {+ const el = bodyRef.current+ if (!el || !filePath) return+ let disposed = false+ let editor: monaco.editor.IStandaloneCodeEditor | null = null+ let model: monaco.editor.ITextModel | null = null++ window.nodeTerminal.fs.read(filePath).then((content) => {+ if (disposed) return+ const s = useSettings.getState().settings+ // Unique model per node (fragment), language still inferred from the path extension.+ const uri = monaco.Uri.file(filePath).with({ fragment: id })+ model = monaco.editor.getModel(uri) ?? monaco.editor.createModel(content, undefined, uri)+ editor = monaco.editor.create(el, {+ model,+ theme: 'vs-dark',+ fontSize: s.fontSize,+ fontFamily: s.fontFamily,+ minimap: { enabled: false },+ automaticLayout: true,+ scrollBeyondLastLine: false,+ smoothScrolling: true,+ tabSize: 2+ })+ editorRef.current = editor+ savedRef.current = content+ editor.onDidChangeModelContent(() => setDirty(editor!.getValue() !== savedRef.current))+ editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => saveRef.current())+ })++ return () => {+ disposed = true+ editor?.dispose()+ model?.dispose()+ editorRef.current = null+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [])++ return (+ <div+ className={`term-node editor-node${selected ? ' selected' : ''}`}+ style={{ borderTopColor: data.color }}+ >+ <NodeResizer minWidth={320} minHeight={200} isVisible={selected} color={data.color} />++ <div className="term-node__header">+ <span className="term-node__title-text" title={filePath}>+ {fileName}+ {dirty ? ' ●' : ''}+ </span>+ <span className="term-node__spacer" />+ <button className="editor-node__save" disabled={!dirty} title="Save (⌘S)" onClick={save}>+ Save+ </button>+ <button+ className="term-node__close"+ title="Close"+ onClick={() => deleteElements({ nodes: [{ id }] })}+ >+ ×+ </button>+ </div>++ <div className="editor-node__body nodrag nowheel" ref={bodyRef} />+ </div>+ )+}diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex fda1c584d..70fee7ca7 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -2,16 +2,26 @@ import { useEffect, useRef, useState } from 'react'import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'import { Terminal } from '@xterm/xterm'import { FitAddon } from '@xterm/addon-fit'+import { marked } from 'marked'+import DOMPurify from 'dompurify'import { transport } from '../terminal/local-transport'import { patchTerminalScale } from '../terminal/scale-fix'import { NodeTags } from '../components/NodeTags'+import { Tooltip } from '../components/Tooltip'import { useSettings } from '../state/settings'import { COLLAPSED_HEIGHT, NODE_COLORS, type CanvasNode } from '../state/workspace'+/** Render terminal output as markdown, sanitized to prevent XSS. */+function renderMarkdown(src: string): string {+ const html = marked.parse(src || '', { async: false }) as string+ return DOMPurify.sanitize(html)+}+/*** A single terminal node: header (collapse + color + title + close), optional tag chips,* and a real xterm.js terminal. A hover guard delays entering the terminal so the canvas- * can be panned across terminals without grabbing focus.+ * can be panned across terminals without grabbing focus. Cmd/Ctrl+M (while hovered)+ * toggles a markdown view of the terminal's output.*/export function TerminalNode({ id, data, selected }: NodeProps<CanvasNode>) {const { updateNodeData, deleteElements, getZoom, setNodes } = useReactFlow()@@ -22,6 +32,11 @@ export function TerminalNode({ id, data, selected }: NodeProps<CanvasNode>) {const dwellRef = useRef<ReturnType<typeof setTimeout> | null>(null)const [showColors, setShowColors] = useState(false)const [armed, setArmed] = useState(true)+ const [naming, setNaming] = useState(false)+ const [mdHtml, setMdHtml] = useState('')+ const [editingTitle, setEditingTitle] = useState(false)+ const hoveredRef = useRef(false)+ const mdMode = !!data.mdModeconst collapsed = !!data.collapsedconst tags = (data.tags as string[]) ?? []@@ -65,6 +80,11 @@ export function TerminalNode({ id, data, selected }: NodeProps<CanvasNode>) {}))cleanups.push(term.onData((input) => transport.write(sid, input)).dispose)+ // Run a one-shot command on first open (e.g. "gh auth login"), then forget it.+ if (data.initialCommand) {+ transport.write(sid, `${data.initialCommand}\n`)+ updateNodeData(id, { initialCommand: undefined })+ }})const resize = () => {@@ -135,16 +155,39 @@ export function TerminalNode({ id, data, selected }: NodeProps<CanvasNode>) {setArmed(true)termRef.current?.blur()}- const enterNow = () => {+ // While armed, a mousedown might start a node drag — pause the dwell timer so the+ // terminal doesn't grab focus mid-drag; restart it on release.+ const onGuardDown = () => {if (dwellRef.current) clearTimeout(dwellRef.current)- setArmed(false)- termRef.current?.focus()}+ const nameWithAi = async () => {+ setNaming(true)+ const r = await window.nodeTerminal.pty.generateName(id, (data.cwd as string) ?? '')+ setNaming(false)+ if (r.ok) updateNodeData(id, { title: r.message })+ }++ // Cmd/Ctrl+M toggles markdown view of this terminal's output (only when hovered).+ useEffect(() => {+ return window.nodeTerminal.onMarkdownToggle(() => {+ if (hoveredRef.current) updateNodeData(id, (n) => ({ mdMode: !n.data.mdMode }))+ })+ }, [id, updateNodeData])++ // When markdown mode turns on, capture the terminal output and render it.+ useEffect(() => {+ if (data.mdMode) {+ void window.nodeTerminal.pty.capture(id).then((t) => setMdHtml(renderMarkdown(t)))+ }+ }, [data.mdMode, id])+return (<divclassName={`term-node${selected ? ' selected' : ''}${collapsed ? ' collapsed' : ''}`}style={{ borderTopColor: data.color }}+ onMouseEnter={() => (hoveredRef.current = true)}+ onMouseLeave={() => (hoveredRef.current = false)}><NodeResizer minWidth={260} minHeight={160} isVisible={selected && !collapsed} color="#0a84ff" />@@ -172,12 +215,33 @@ export function TerminalNode({ id, data, selected }: NodeProps<CanvasNode>) {))}</div>)}- <input- className="term-node__title nodrag"- value={data.title}- spellCheck={false}- onChange={(e) => updateNodeData(id, { title: e.target.value })}- />+ {editingTitle ? (+ <input+ className="term-node__title nodrag"+ value={data.title}+ spellCheck={false}+ autoFocus+ onChange={(e) => updateNodeData(id, { title: e.target.value })}+ onBlur={() => setEditingTitle(false)}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === 'Escape') setEditingTitle(false)+ }}+ />+ ) : (+ <span+ className="term-node__title-text nodrag"+ title="Click to rename"+ onClick={() => setEditingTitle(true)}+ >+ {data.title || 'Untitled'}+ </span>+ )}+ {!editingTitle && <span className="term-node__spacer" />}+ <Tooltip label="Name with AI (from terminal output)">+ <button className="term-node__ai nodrag" disabled={naming} onClick={nameWithAi}>+ {naming ? '…' : '✦'}+ </button>+ </Tooltip><buttonclassName="term-node__close"title="Close (ends the session)"@@ -197,8 +261,22 @@ export function TerminalNode({ id, data, selected }: NodeProps<CanvasNode>) {{/* Body always mounted (keeps xterm alive); hidden via CSS when collapsed. */}<div className="term-node__body" onMouseEnter={onBodyEnter} onMouseLeave={onBodyLeave}><div className="term-node__xterm nodrag nowheel" ref={bodyRef} />- {armed && (- <div className="term-hover-guard nodrag nowheel" onMouseDown={enterNow} title="Click to focus" />+ {armed && !mdMode && (+ <div+ className="term-hover-guard"+ onMouseDown={onGuardDown}+ onMouseUp={onBodyEnter}+ title="Drag to move · scroll to pan · hover to focus"+ />+ )}+ {mdMode && (+ <div className="term-md nodrag nowheel">+ <div className="term-md__bar">+ <span>Markdown</span>+ <span className="term-md__hint">⌘M to exit</span>+ </div>+ <div className="term-md__content" dangerouslySetInnerHTML={{ __html: mdHtml }} />+ </div>)}</div></div>diff --git a/src/renderer/state/projects.ts b/src/renderer/state/projects.tsindex 0077b4f08..d29fd3782 100644--- a/src/renderer/state/projects.ts+++ b/src/renderer/state/projects.ts@@ -64,14 +64,12 @@ export const useProjects = create<ProjectsState>((set, get) => ({deleteProject(id) {const { projects, activeProjectId } = get()- if (projects.length <= 1) return activeProjectId // never delete the last project-const index = projects.findIndex((p) => p.id === id)const remaining = projects.filter((p) => p.id !== id)let nextActive = activeProjectIdif (activeProjectId === id) {- // pick the neighbor that takes this slot (or the new last one)- nextActive = remaining[Math.min(index, remaining.length - 1)].id+ // pick the neighbor that takes this slot, or '' (welcome screen) when none remain+ nextActive = remaining.length ? remaining[Math.min(index, remaining.length - 1)].id : ''}set({ projects: remaining, activeProjectId: nextActive })return nextActivediff --git a/src/renderer/state/workspace.ts b/src/renderer/state/workspace.tsindex c17879a10..be7de5ef1 100644--- a/src/renderer/state/workspace.ts+++ b/src/renderer/state/workspace.ts@@ -12,9 +12,10 @@ export const NODE_COLORS = ['#ff9f0a' // systemOrange]-const TERMINAL_SIZE = { width: 440, height: 300 }+const TERMINAL_SIZE = { width: 600, height: 400 }const STICKY_SIZE = { width: 240, height: 200 }const GROUP_SIZE = { width: 520, height: 360 }+const EDITOR_SIZE = { width: 660, height: 460 }/** Height of a node when collapsed (header only). */export const COLLAPSED_HEIGHT = 40@@ -28,9 +29,12 @@ export interface NodeData {collapsed?: boolean/** Expanded height to restore when un-collapsing (kept out of the persisted size). */expandedHeight?: number+ /** One-shot command run once when the terminal first opens (not persisted). */+ initialCommand?: stringshell?: stringcwd?: stringtext?: string+ filePath?: string[key: string]: unknown}@@ -56,7 +60,8 @@ function placeAt(center: { x: number; y: number } | undefined, index: number, w:export function createTerminalNode(index: number,cwd?: string,- center?: { x: number; y: number }+ center?: { x: number; y: number },+ initialCommand?: string): CanvasNode {return {id: nextId('term'),@@ -70,7 +75,54 @@ export function createTerminalNode(color: NODE_COLORS[index % NODE_COLORS.length],group: null,tags: [],- cwd+ cwd,+ initialCommand+ }+ }+}++/** Creates a terminal that launches Claude Code (`claude`) on open. */+export function createClaudeNode(+ index: number,+ cwd?: string,+ center?: { x: number; y: number }+): CanvasNode {+ return {+ id: nextId('term'),+ type: 'terminal',+ position: placeAt(center, index, TERMINAL_SIZE.width, TERMINAL_SIZE.height),+ width: TERMINAL_SIZE.width,+ height: TERMINAL_SIZE.height,+ style: { width: TERMINAL_SIZE.width, height: TERMINAL_SIZE.height },+ data: {+ title: 'Claude Code',+ color: '#d97757',+ group: null,+ tags: ['claude'],+ cwd,+ initialCommand: 'claude'+ }+ }+}++/** Creates a code editor node for a file. */+export function createEditorNode(+ index: number,+ filePath: string,+ center?: { x: number; y: number }+): CanvasNode {+ return {+ id: nextId('editor'),+ type: 'editor',+ position: placeAt(center, index, EDITOR_SIZE.width, EDITOR_SIZE.height),+ width: EDITOR_SIZE.width,+ height: EDITOR_SIZE.height,+ style: { width: EDITOR_SIZE.width, height: EDITOR_SIZE.height },+ data: {+ title: filePath.split('/').pop() || 'untitled',+ color: '#6ac4dc',+ group: null,+ filePath}}}@@ -173,6 +225,21 @@ export function groupSelectedNodes(return [group, ...updated]}+/** Returns a copy of a node with a fresh id, offset position, and top-level placement. */+export function duplicateNode(node: CanvasNode, offset = 28): CanvasNode {+ const kind: NodeKind = node.type === 'sticky' ? 'sticky' : node.type === 'group' ? 'group' : 'terminal'+ const prefix = kind === 'terminal' ? 'term' : kind+ return {+ ...node,+ id: nextId(prefix),+ position: { x: node.position.x + offset, y: node.position.y + offset },+ selected: true,+ parentId: undefined,+ extent: undefined,+ data: { ...node.data, initialCommand: undefined }+ }+}+/** Removes a group frame and restores its children to absolute positions. */export function ungroupNodes(nodes: CanvasNode[], groupId: string): CanvasNode[] {const group = nodes.find((n) => n.id === groupId)@@ -219,7 +286,8 @@ export function nodeStatesToFlow(states: CanvasNodeState[]): CanvasNode[] {expandedHeight: n.size.height,shell: n.shell,cwd: n.cwd,- text: n.text+ text: n.text,+ filePath: n.filePath}}})@@ -228,7 +296,13 @@ export function nodeStatesToFlow(states: CanvasNodeState[]): CanvasNode[] {/** Serializes live React Flow nodes back into persisted node states. */export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {const sizeFor = (kind: NodeKind) =>- kind === 'sticky' ? STICKY_SIZE : kind === 'group' ? GROUP_SIZE : TERMINAL_SIZE+ kind === 'sticky'+ ? STICKY_SIZE+ : kind === 'group'+ ? GROUP_SIZE+ : kind === 'editor'+ ? EDITOR_SIZE+ : TERMINAL_SIZEreturn nodes.map((n) => {const kind: NodeKind = (n.type as NodeKind) ?? 'terminal'const collapsed = !!n.data.collapsed@@ -251,7 +325,8 @@ export function flowToNodeStates(nodes: CanvasNode[]): CanvasNodeState[] {parentId: n.parentId,shell: n.data.shell,cwd: n.data.cwd,- text: n.data.text+ text: n.data.text,+ filePath: n.data.filePath}})}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 1c4846b15..e0982d86c 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -71,19 +71,36 @@ body,-webkit-app-region: no-drag;}-.tabbar__brand {- font-size: 13px;+/* Brand: gradient app-tile + wordmark */+.brand {+ display: flex;+ align-items: center;+ gap: 9px;+ white-space: nowrap;+ -webkit-app-region: drag;+}++.brand__mark {+ flex-shrink: 0;+}++.brand__name {+ font-size: 14px;font-weight: 700;- color: var(--muted);+ color: var(--text);letter-spacing: 0.2px;- white-space: nowrap;}+/* Tabs as a single rounded pill of segments */.tabbar__tabs {display: flex;- align-items: stretch;+ align-items: center;gap: 2px;- height: 100%;+ height: 34px;+ padding: 3px;+ background: rgba(255, 255, 255, 0.05);+ border: 1px solid var(--border);+ border-radius: 17px;overflow-x: auto;}@@ -92,9 +109,9 @@ body,display: flex;align-items: center;gap: 7px;- padding: 0 10px;+ padding: 0 12px;height: 100%;- border-bottom: 2px solid transparent;+ border-radius: 14px;color: var(--muted);font-size: 13px;cursor: pointer;@@ -102,12 +119,12 @@ body,}.tab:hover {- background: var(--panel-header);+ background: rgba(255, 255, 255, 0.05);}.tab.active {- color: var(--text);- background: var(--panel-header);+ background: rgba(255, 255, 255, 0.09);+ font-weight: 600;}.tab__dot {@@ -137,17 +154,21 @@ body,.tab__caret {background: transparent;border: none;- color: var(--muted);+ color: currentColor;cursor: pointer;- font-size: 13px;+ font-size: 12px;line-height: 1;- padding: 2px 3px;+ padding: 2px 2px;border-radius: 4px;+ opacity: 0;+}++.tab:hover .tab__caret {+ opacity: 0.7;}.tab__caret:hover {- background: var(--border);- color: var(--text);+ opacity: 1;}.tab__add {@@ -155,19 +176,19 @@ body,align-items: center;justify-content: center;align-self: center;- width: 26px;- height: 26px;- margin-left: 4px;+ width: 28px;+ height: 28px;background: transparent;- border: 1px solid var(--border);- border-radius: 7px;- color: var(--text);- font-size: 16px;+ border: none;+ border-radius: 14px;+ color: var(--muted);+ font-size: 17px;cursor: pointer;}.tab__add:hover {- background: var(--panel-header);+ background: rgba(255, 255, 255, 0.07);+ color: var(--text);}.tab-backdrop {@@ -259,10 +280,15 @@ body,cursor: pointer;}-.dock-btn:hover {+.dock-btn:hover:not(:disabled) {background: var(--panel-header);}+.dock-btn:disabled {+ opacity: 0.35;+ cursor: not-allowed;+}+.dock-add {background: var(--accent);color: #fff;@@ -405,6 +431,71 @@ body,padding: 2px 4px;}+/* Title shown as text; only the name itself is clickable to rename. */+.term-node__title-text {+ font-size: 13px;+ font-weight: 600;+ color: var(--text);+ max-width: 220px;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ padding: 2px 5px;+ border-radius: 4px;+ cursor: text;+}++.term-node__title-text:hover {+ background: rgba(255, 255, 255, 0.06);+}++/* Pushes the AI / close buttons to the far right. */+.term-node__spacer {+ flex: 1;+}++.tooltip-trigger {+ display: inline-flex;+}++.tooltip {+ position: fixed;+ transform: translateX(-50%);+ z-index: 90;+ background: var(--panel-header);+ color: var(--text);+ font-size: 11px;+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;+ padding: 5px 9px;+ border-radius: 7px;+ border: 1px solid var(--border);+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);+ pointer-events: none;+ white-space: nowrap;+}++.term-node__ai {+ background: transparent;+ border: none;+ color: var(--muted);+ cursor: pointer;+ font-size: 13px;+ line-height: 1;+ padding: 2px 5px;+ border-radius: 4px;+ flex-shrink: 0;+}++.term-node__ai:hover:not(:disabled) {+ background: rgba(10, 132, 255, 0.18);+ color: #6cb0ff;+}++.term-node__ai:disabled {+ opacity: 0.6;+ cursor: default;+}+.term-node__close {background: transparent;border: none;@@ -438,12 +529,125 @@ body,height: 100%;}+/* Markdown view overlay (Cmd/Ctrl+M) */+.term-md {+ position: absolute;+ inset: 0;+ z-index: 3;+ display: flex;+ flex-direction: column;+ background: var(--bg);+}++.term-md__bar {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 5px 10px;+ font-size: 11px;+ color: var(--muted);+ border-bottom: 1px solid var(--border);+ background: var(--panel);+}++.term-md__hint {+ opacity: 0.8;+}++.term-md__content {+ flex: 1;+ min-height: 0;+ overflow: auto;+ padding: 12px 16px;+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;+ font-size: 13px;+ line-height: 1.6;+ color: var(--text);+ /* Allow text selection / copy (React Flow nodes are non-selectable by default). */+ user-select: text;+ -webkit-user-select: text;+ cursor: auto;+}++.term-md__content h1,+.term-md__content h2,+.term-md__content h3 {+ margin: 14px 0 8px;+ line-height: 1.3;+}++.term-md__content h1 {+ font-size: 20px;+}+.term-md__content h2 {+ font-size: 17px;+}+.term-md__content h3 {+ font-size: 15px;+}++.term-md__content p,+.term-md__content ul,+.term-md__content ol {+ margin: 0 0 10px;+}++.term-md__content a {+ color: var(--accent);+}++.term-md__content code {+ font-family: Menlo, Monaco, monospace;+ font-size: 12px;+ background: rgba(255, 255, 255, 0.08);+ padding: 1px 5px;+ border-radius: 5px;+}++.term-md__content pre {+ background: #000;+ border: 1px solid var(--border);+ border-radius: 8px;+ padding: 10px 12px;+ overflow: auto;+}++.term-md__content pre code {+ background: none;+ padding: 0;+}++.term-md__content blockquote {+ margin: 0 0 10px;+ padding-left: 12px;+ border-left: 3px solid var(--border);+ color: var(--muted);+}++.term-md__content img {+ max-width: 100%;+}++.term-md__content table {+ border-collapse: collapse;+}++.term-md__content th,+.term-md__content td {+ border: 1px solid var(--border);+ padding: 4px 8px;+}+/* Transparent overlay that lets you pan across a terminal until you dwell/click. */.term-hover-guard {position: absolute;inset: 0;z-index: 2;- cursor: default;+ cursor: grab;+}++.term-hover-guard:active {+ cursor: grabbing;}.term-node.collapsed {@@ -559,7 +763,7 @@ body,}.react-flow {- background: var(--bg);+ background: #000000;}.flow-wrap {@@ -568,6 +772,75 @@ body,position: relative;}+/* ---- Welcome / empty state ---- */+.welcome {+ position: absolute;+ inset: 0;+ z-index: 5;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 6px;+ background: #000;+}++.welcome__brand {+ display: flex;+ align-items: center;+ gap: 12px;+}++.welcome__name {+ font-size: 30px;+ font-weight: 800;+ letter-spacing: -0.5px;+ color: var(--text);+}++.welcome__tagline {+ margin: 4px 0 28px;+ font-size: 13px;+ color: var(--muted);+}++.welcome__cards {+ display: flex;+ gap: 14px;+}++.welcome__card {+ width: 150px;+ height: 92px;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 10px;+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 12px;+ color: var(--text);+ font-size: 13px;+ cursor: pointer;+ transition: background 0.12s, border-color 0.12s;+}++.welcome__card svg {+ width: 22px;+ height: 22px;+ color: var(--muted);+}++.welcome__card:hover {+ background: var(--panel-header);+ border-color: rgba(255, 255, 255, 0.18);+}++.welcome__card:hover svg {+ color: var(--accent);+}+/* ---- Right-click context menu ---- */.ctx-backdrop {position: fixed;@@ -592,6 +865,7 @@ body,.ctx-item {display: flex;align-items: center;+ gap: 10px;padding: 8px 10px;background: transparent;border: none;@@ -602,6 +876,20 @@ body,cursor: pointer;}+.ctx-icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 16px;+ height: 16px;+ flex-shrink: 0;+ color: var(--muted);+}++.ctx-item.danger .ctx-icon {+ color: inherit;+}+.ctx-item:hover:not(:disabled) {background: var(--panel-header);}@@ -648,6 +936,36 @@ body,cursor: pointer;}+/* ---- Editor (Monaco) node ---- */+.editor-node__body {+ flex: 1;+ min-height: 0;+ overflow: hidden;+ background: #1e1e1e;+}++.editor-node__save {+ background: transparent;+ border: 1px solid var(--border);+ border-radius: 6px;+ color: var(--muted);+ font-size: 11px;+ padding: 3px 9px;+ cursor: pointer;+ flex-shrink: 0;+}++.editor-node__save:not(:disabled) {+ color: #fff;+ background: var(--accent);+ border-color: transparent;+}++.editor-node__save:disabled {+ cursor: default;+ opacity: 0.6;+}+/* ---- Sticky note node ---- */.sticky-node {width: 100%;@@ -724,6 +1042,29 @@ body,background: var(--panel-header);}+/* Search button shows the ⌘K shortcut so its purpose is obvious */+.cluster-search {+ width: auto !important;+ gap: 7px;+ padding: 0 10px;+}++.cluster-search__icon {+ font-size: 15px;+ color: var(--muted);+}++.kbd {+ font-size: 11px;+ font-weight: 600;+ color: var(--muted);+ background: rgba(255, 255, 255, 0.07);+ border: 1px solid var(--border);+ border-radius: 5px;+ padding: 1px 6px;+ line-height: 1.4;+}+/* ---- Right-side drawer (settings / source control) ---- */.drawer-overlay {position: fixed;@@ -966,6 +1307,38 @@ body,}/* ---- Source control (VS Code style) ---- */+.scm-signin {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 10px;+ margin: 12px 0 4px;+ padding: 10px 12px;+ background: rgba(10, 132, 255, 0.1);+ border: 1px solid rgba(10, 132, 255, 0.3);+ border-radius: 10px;+ font-size: 12px;+ color: var(--text);+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;+}++.scm-signin button {+ background: var(--accent);+ color: #fff;+ border: none;+ border-radius: 7px;+ padding: 6px 12px;+ font-size: 12px;+ font-weight: 600;+ cursor: pointer;+ white-space: nowrap;+}++.scm-signin button:hover {+ background: var(--accent-hover);+}++.scm-bar {display: flex;align-items: center;@@ -1310,6 +1683,218 @@ body,font-size: 11px;}+/* ---- Explorer (file tree) ---- */+.ex-head-actions {+ display: flex;+ align-items: center;+ gap: 8px;+}++.ex-head-actions button {+ background: transparent;+ border: none;+ color: var(--muted);+ font-size: 16px;+ line-height: 1;+ cursor: pointer;+}++.ex-head-actions button:hover {+ color: var(--text);+}++.ex-body {+ padding: 6px 4px 20px;+ font-size: 13px;+}++.ex-row {+ display: flex;+ align-items: center;+ gap: 6px;+ height: 26px;+ padding-right: 8px;+ border-radius: 6px;+ color: var(--text);+ cursor: pointer;+ white-space: nowrap;+ overflow: hidden;+}++.ex-row:hover {+ background: var(--panel-header);+}++.ex-chevron {+ flex-shrink: 0;+ width: 12px;+ text-align: center;+ color: var(--muted);+ transition: transform 0.1s;+}++.ex-chevron.open {+ transform: rotate(90deg);+}++.ex-chevron.hidden {+ visibility: hidden;+}++.ex-icon {+ width: 15px;+ height: 15px;+ flex-shrink: 0;+ color: var(--muted);+}++.ex-name {+ overflow: hidden;+ text-overflow: ellipsis;+}++/* ---- Confirm dialog ---- */+.confirm-overlay {+ position: fixed;+ inset: 0;+ z-index: 70;+ display: flex;+ align-items: center;+ justify-content: center;+ background: rgba(10, 12, 18, 0.55);+}++.confirm {+ width: 320px;+ max-width: 90vw;+ background: rgba(40, 40, 42, 0.99);+ border: 1px solid var(--border);+ border-radius: 14px;+ box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);+ padding: 18px;+}++.confirm__msg {+ margin: 0 0 16px;+ font-size: 13px;+ line-height: 1.5;+ color: var(--text);+}++.confirm__actions {+ display: flex;+ justify-content: flex-end;+ gap: 8px;+}++.confirm__btn {+ background: var(--panel-header);+ border: 1px solid var(--border);+ border-radius: 8px;+ color: var(--text);+ font-size: 13px;+ padding: 7px 14px;+ cursor: pointer;+}++.confirm__btn:hover {+ background: rgba(255, 255, 255, 0.1);+}++.confirm__btn.danger {+ background: #ff453a;+ border-color: transparent;+ color: #fff;+ font-weight: 600;+}++.confirm__btn.danger:hover {+ background: #ff5e54;+}++.confirm__btn.primary {+ background: var(--accent);+ border-color: transparent;+ color: #fff;+ font-weight: 600;+}++/* ---- Shortcuts panel ---- */+.sc-overlay {+ position: fixed;+ inset: 0;+ z-index: 62;+ display: flex;+ align-items: center;+ justify-content: center;+ background: rgba(10, 12, 18, 0.5);+}++.shortcuts {+ width: 560px;+ max-width: 92vw;+ max-height: 80vh;+ display: flex;+ flex-direction: column;+ background: rgba(40, 40, 42, 0.99);+ border: 1px solid var(--border);+ border-radius: 14px;+ box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);+ overflow: hidden;+}++.shortcuts__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ padding: 14px 18px;+ border-bottom: 1px solid var(--border);+}++.shortcuts__head h2 {+ margin: 0;+ font-size: 15px;+}++.shortcuts__body {+ overflow-y: auto;+ padding: 8px 18px 20px;+ column-count: 2;+ column-gap: 28px;+}++.shortcuts__body section {+ break-inside: avoid;+ padding: 12px 0 4px;+}++.shortcuts__body h3 {+ margin: 0 0 8px;+ font-size: 11px;+ text-transform: uppercase;+ letter-spacing: 0.4px;+ color: var(--muted);+}++.shortcut-row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ padding: 5px 0;+ font-size: 13px;+}++.shortcut-label {+ color: var(--text);+}++.shortcut-keys {+ display: flex;+ gap: 3px;+ flex-shrink: 0;+}+/* ---- Command palette ---- */.palette-overlay {position: fixed;@@ -1353,7 +1938,7 @@ body,.palette__item {display: flex;align-items: center;- justify-content: space-between;+ gap: 10px;width: 100%;padding: 9px 12px;background: transparent;@@ -1369,7 +1954,18 @@ body,background: var(--panel-header);}+.palette__icon {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 16px;+ height: 16px;+ flex-shrink: 0;+ color: var(--muted);+}+.palette__hint {+ margin-left: auto;color: var(--muted);font-size: 11px;}diff --git a/src/renderer/vite-env.d.ts b/src/renderer/vite-env.d.tsnew file mode 100644index 000000000..11f02fe2a--- /dev/null+++ b/src/renderer/vite-env.d.ts@@ -0,0 +1 @@+/// <reference types="vite/client" />diff --git a/src/shared/ipc.ts b/src/shared/ipc.tsindex 4b84641ca..d9cfbbb03 100644--- a/src/shared/ipc.ts+++ b/src/shared/ipc.ts@@ -6,16 +6,25 @@ export const IPC = {ptyResize: 'pty:resize',ptyKill: 'pty:kill',ptyDestroy: 'pty:destroy',+ ptyGenerateName: 'pty:generate-name',+ ptyCapture: 'pty:capture',+ appToggleMarkdown: 'app:toggle-markdown',// Events broadcast from main to the renderer (sessionId is appended to the channel name).ptyData: (sessionId: string) => `pty:data:${sessionId}`,ptyExit: (sessionId: string) => `pty:exit:${sessionId}`,workspaceLoad: 'workspace:load',workspaceSave: 'workspace:save',dialogSelectFolder: 'dialog:select-folder',+ shellReveal: 'shell:reveal',+ shellOpenPath: 'shell:open-path',+ fsList: 'fs:list',+ fsRead: 'fs:read',+ fsWrite: 'fs:write',settingsLoad: 'settings:load',settingsSave: 'settings:save',gitStatus: 'git:status',gitInit: 'git:init',+ gitClone: 'git:clone',gitCommit: 'git:commit',gitPush: 'git:push',gitPull: 'git:pull',diff --git a/src/shared/types.ts b/src/shared/types.tsindex bbcfc464f..c6e05e276 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -12,9 +12,9 @@ export interface PtyCreateOptions {persistKey?: string}-export type NodeKind = 'terminal' | 'sticky' | 'group'+export type NodeKind = 'terminal' | 'sticky' | 'group' | 'editor'-/** Persisted state of a single canvas node (terminal, sticky note, or group frame). */+/** Persisted state of a single canvas node (terminal, sticky note, group frame, or editor). */export interface CanvasNodeState {id: stringkind: NodeKind@@ -34,6 +34,8 @@ export interface CanvasNodeState {cwd?: string// sticky-onlytext?: string+ // editor-only+ filePath?: string}/** Canvas pan/zoom state. */@@ -97,6 +99,10 @@ export interface PtyApi {kill(sessionId: string): void/** Permanently ends the persistent session for a node (kills its tmux session). */destroy(persistKey: string): void+ /** Suggest a terminal title from its recent output via the configured AI agent. */+ generateName(persistKey: string, cwd: string): Promise<GitResult>+ /** Capture a terminal session's recent visible output as text. */+ capture(persistKey: string): Promise<string>/** Listens for PTY output. Returns an unsubscribe function. */onData(sessionId: string, listener: (data: string) => void): () => void/** Fires when the PTY process exits. Returns an unsubscribe function. */@@ -113,6 +119,31 @@ export interface DialogApi {selectFolder(): Promise<string | null>}+export interface ClipboardApi {+ writeText(text: string): void+}++export interface ShellApi {+ /** Reveal a path in the OS file manager (Finder). */+ reveal(path: string): void+ /** Open a path with the OS default application. */+ openPath(path: string): void+}++export interface DirEntry {+ name: string+ dir: boolean+}++export interface FsApi {+ /** List a directory (folders first, then files; alphabetical). */+ list(dirPath: string): Promise<DirEntry[]>+ /** Read a file's text contents (empty string on error). */+ read(filePath: string): Promise<string>+ /** Write text to a file; resolves true on success. */+ write(filePath: string, content: string): Promise<boolean>+}+/** User-configurable application settings (settings.json). */export interface Settings {fontSize: number@@ -134,6 +165,8 @@ export interface Settings {commitAgentCommand: string/** Extra instructions appended to the commit prompt (e.g. Conventional Commits). */commitExtraPrompt: string+ /** Whether the shortcuts overlay has been shown on first launch. */+ seenShortcuts: boolean}export const DEFAULT_SETTINGS: Settings = {@@ -143,14 +176,15 @@ export const DEFAULT_SETTINGS: Settings = {defaultShell: '',gridSize: 24,snapToGrid: false,- panHoverDelay: 300,+ panHoverDelay: 600,doubleClickFocus: true,accent: '#0a84ff',tmuxEnabled: true,tmuxScrollback: 50000,commitAgent: 'claude',commitAgentCommand: '',- commitExtraPrompt: ''+ commitExtraPrompt: '',+ seenShortcuts: false}export interface SettingsApi {@@ -183,6 +217,7 @@ export interface GitStatus {behind: numberhasRemote: booleanghAvailable: boolean+ ghAuthed: booleanstaged: GitFileChange[]changes: GitFileChange[]recent: GitCommit[]@@ -196,6 +231,8 @@ export interface GitResult {export interface GitApi {status(cwd: string): Promise<GitStatus>init(cwd: string): Promise<GitResult>+ /** Clone a repo into parentDir; returns the cloned folder path in message on success. */+ clone(parentDir: string, url: string): Promise<GitResult>/** Commits the staged changes (no implicit add). */commit(cwd: string, message: string): Promise<GitResult>push(cwd: string): Promise<GitResult>@@ -223,4 +260,9 @@ export interface NodeTerminalApi {dialog: DialogApisettings: SettingsApigit: GitApi+ clipboard: ClipboardApi+ shell: ShellApi+ fs: FsApi+ /** Fires when the user presses Cmd/Ctrl+M (toggle markdown view). Returns unsubscribe. */+ onMarkdownToggle(listener: () => void): () => void}