Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Rename local chat shortcut and surface terminal close hints
Julius Marmingebc22a71f10ac
diff --git a/KEYBINDINGS.md b/KEYBINDINGS.mdindex 7734d4ebe..16fce1a4d 100644--- a/KEYBINDINGS.md+++ b/KEYBINDINGS.md@@ -24,7 +24,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`]({ "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" },{ "key": "mod+w", "command": "terminal.close", "when": "terminalFocus" },{ "key": "mod+shift+o", "command": "chat.new" },- { "key": "mod+shift+n", "command": "chat.newSameGitState" },+ { "key": "mod+shift+n", "command": "chat.newLocal" },{ "key": "mod+o", "command": "editor.openFavorite" }]```@@ -49,8 +49,8 @@ Invalid rules are ignored. Invalid config files are ignored. Warnings are logged- `terminal.split`: split terminal (in focused terminal context by default)- `terminal.new`: create new terminal (in focused terminal context by default)- `terminal.close`: close/kill the focused terminal (in focused terminal context by default)-- `chat.new`: create a new chat thread for the active project-- `chat.newSameGitState`: create a new chat thread preserving the active thread's branch/worktree state+- `chat.new`: create a new chat thread preserving the active thread's branch/worktree state+- `chat.newLocal`: create a new local chat thread for the active project (no worktree context)- `editor.openFavorite`: open current project/worktree in the last-used editor### Key Syntaxdiff --git a/apps/server/src/keybindings.test.ts b/apps/server/src/keybindings.test.tsindex 18ecbabc0..364ebc486 100644--- a/apps/server/src/keybindings.test.ts+++ b/apps/server/src/keybindings.test.ts@@ -71,7 +71,7 @@ describe("server keybindings", () => {);});- it("defines defaults for terminal.close and chat.newSameGitState", () => {+ it("defines defaults for terminal.close and chat.newLocal", () => {assert.deepInclude(DEFAULT_KEYBINDINGS, {key: "mod+w",command: "terminal.close",@@ -79,7 +79,7 @@ describe("server keybindings", () => {});assert.deepInclude(DEFAULT_KEYBINDINGS, {key: "mod+shift+n",- command: "chat.newSameGitState",+ command: "chat.newLocal",});});});diff --git a/apps/server/src/keybindings.ts b/apps/server/src/keybindings.tsindex 5750b4f4b..a78e25b31 100644--- a/apps/server/src/keybindings.ts+++ b/apps/server/src/keybindings.ts@@ -30,7 +30,7 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [{ key: "mod+n", command: "terminal.new", when: "terminalFocus" },{ key: "mod+w", command: "terminal.close", when: "terminalFocus" },{ key: "mod+shift+o", command: "chat.new" },- { key: "mod+shift+n", command: "chat.newSameGitState" },+ { key: "mod+shift+n", command: "chat.newLocal" },{ key: "mod+o", command: "editor.openFavorite" },];diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex d308ec63f..ccbbd10d7 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -279,6 +279,10 @@ export default function ChatView() {() => shortcutLabelForCommand(keybindings, "terminal.new"),[keybindings],);+ const closeTerminalShortcutLabel = useMemo(+ () => shortcutLabelForCommand(keybindings, "terminal.close"),+ [keybindings],+ );const envLocked = Boolean(activeThread &&@@ -1464,6 +1468,7 @@ export default function ChatView() {onNewTerminal={createNewTerminal}splitShortcutLabel={splitTerminalShortcutLabel ?? undefined}newShortcutLabel={newTerminalShortcutLabel ?? undefined}+ closeShortcutLabel={closeTerminalShortcutLabel ?? undefined}onActiveTerminalChange={activateTerminal}onCloseTerminal={closeTerminal}onHeightChange={(height) =>diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex 2a3deef38..2c29a6da4 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -7,7 +7,7 @@ import { useTheme } from "../hooks/useTheme";import { DEFAULT_MODEL } from "../model-logic";import { derivePendingApprovals } from "../session-logic";import { useStore } from "../store";-import { isChatNewSameGitStateShortcut, isChatNewShortcut } from "../keybindings";+import { isChatNewLocalShortcut, isChatNewShortcut } from "../keybindings";import {DEFAULT_THREAD_TERMINAL_HEIGHT,DEFAULT_THREAD_TERMINAL_ID,@@ -388,14 +388,11 @@ export default function Sidebar() {useEffect(() => {const onWindowKeyDown = (event: KeyboardEvent) => {const activeThread = state.threads.find((t) => t.id === state.activeThreadId);- if (isChatNewSameGitStateShortcut(event, keybindings)) {+ if (isChatNewLocalShortcut(event, keybindings)) {const projectId = activeThread?.projectId ?? state.projects[0]?.id;if (!projectId) return;event.preventDefault();- handleNewThread(projectId, {- branch: activeThread?.branch ?? null,- worktreePath: activeThread?.worktreePath ?? null,- });+ handleNewThread(projectId);return;}@@ -403,7 +400,10 @@ export default function Sidebar() {const projectId = activeThread?.projectId ?? state.projects[0]?.id;if (!projectId) return;event.preventDefault();- handleNewThread(projectId);+ handleNewThread(projectId, {+ branch: activeThread?.branch ?? null,+ worktreePath: activeThread?.worktreePath ?? null,+ });};window.addEventListener("keydown", onWindowKeyDown);diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsxindex d74ba49a0..1c35459a9 100644--- a/apps/web/src/components/ThreadTerminalDrawer.tsx+++ b/apps/web/src/components/ThreadTerminalDrawer.tsx@@ -1,5 +1,5 @@import { FitAddon } from "@xterm/addon-fit";-import { Plus, SquareSplitHorizontal, TerminalSquare, Trash2 } from "lucide-react";+import { Plus, SquareSplitHorizontal, TerminalSquare, Trash2, XIcon } from "lucide-react";import { type NativeApi } from "@t3tools/contracts";import { Terminal, type ITheme } from "@xterm/xterm";import {@@ -18,10 +18,7 @@ import {preferredTerminalEditor,resolvePathLinkTarget,} from "../terminal-links";-import {- isTerminalClearShortcut,- terminalNavigationShortcutData,-} from "../keybindings";+import { isTerminalClearShortcut, terminalNavigationShortcutData } from "../keybindings";import {DEFAULT_THREAD_TERMINAL_HEIGHT,DEFAULT_THREAD_TERMINAL_ID,@@ -161,10 +158,7 @@ function TerminalViewport({try {await api.terminal.write({ threadId, terminalId, data });} catch (error) {- writeSystemMessage(- activeTerminal,- error instanceof Error ? error.message : fallbackError,- );+ writeSystemMessage(activeTerminal, error instanceof Error ? error.message : fallbackError);}};@@ -429,6 +423,7 @@ interface ThreadTerminalDrawerProps {onNewTerminal: () => void;splitShortcutLabel?: string | undefined;newShortcutLabel?: string | undefined;+ closeShortcutLabel?: string | undefined;onActiveTerminalChange: (terminalId: string) => void;onCloseTerminal: (terminalId: string) => void;onHeightChange: (height: number) => void;@@ -444,15 +439,9 @@ interface TerminalActionButtonProps {function TerminalActionButton({ label, className, onClick, children }: TerminalActionButtonProps) {return (<Popover>- <PopoverTrigger openOnHover- render={- <button- type="button"- className={className}- onClick={onClick}- aria-label={label}- />- }+ <PopoverTrigger+ openOnHover+ render={<button type="button" className={className} onClick={onClick} aria-label={label} />}>{children}</PopoverTrigger>@@ -483,6 +472,7 @@ export default function ThreadTerminalDrawer({onNewTerminal,splitShortcutLabel,newShortcutLabel,+ closeShortcutLabel,onActiveTerminalChange,onCloseTerminal,onHeightChange,@@ -598,6 +588,9 @@ export default function ThreadTerminalDrawer({),[normalizedTerminalIds],);+ const closeTerminalActionLabel = closeShortcutLabel+ ? `Close Terminal (${closeShortcutLabel})`+ : "Close Terminal";useEffect(() => {onHeightChangeRef.current = onHeightChange;@@ -709,7 +702,9 @@ export default function ThreadTerminalDrawer({<TerminalActionButtonclassName="p-1 text-foreground/90 transition-colors hover:bg-accent"onClick={onSplitTerminal}- label={splitShortcutLabel ? `Split Terminal (${splitShortcutLabel})` : "Split Terminal"}+ label={+ splitShortcutLabel ? `Split Terminal (${splitShortcutLabel})` : "Split Terminal"+ }><SquareSplitHorizontal className="size-3.25" /></TerminalActionButton>@@ -725,7 +720,7 @@ export default function ThreadTerminalDrawer({<TerminalActionButtonclassName="p-1 text-foreground/90 transition-colors hover:bg-accent"onClick={() => onCloseTerminal(resolvedActiveTerminalId)}- label="Close Terminal"+ label={closeTerminalActionLabel}><Trash2 className="size-3.25" /></TerminalActionButton>@@ -805,16 +800,14 @@ export default function ThreadTerminalDrawer({<TerminalActionButtonclassName="inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70"onClick={onNewTerminal}- label={- newShortcutLabel ? `New Terminal (${newShortcutLabel})` : "New Terminal"- }+ label={newShortcutLabel ? `New Terminal (${newShortcutLabel})` : "New Terminal"}><Plus className="size-3.25" /></TerminalActionButton><TerminalActionButtonclassName="inline-flex h-full items-center border-l border-border/70 px-1 text-foreground/90 transition-colors hover:bg-accent/70"onClick={() => onCloseTerminal(resolvedActiveTerminalId)}- label="Close Terminal"+ label={closeTerminalActionLabel}><Trash2 className="size-3.25" /></TerminalActionButton>@@ -852,6 +845,9 @@ export default function ThreadTerminalDrawer({>{terminalGroup.terminalIds.map((terminalId) => {const isActive = terminalId === resolvedActiveTerminalId;+ const closeTerminalLabel = `Close ${+ terminalLabelById.get(terminalId) ?? "terminal"+ }${isActive && closeShortcutLabel ? ` (${closeShortcutLabel})` : ""}`;return (<divkey={terminalId}@@ -875,18 +871,30 @@ export default function ThreadTerminalDrawer({</span></button>{normalizedTerminalIds.length > 1 && (- <button- type="button"- className="rounded px-1 text-xs font-medium leading-none text-muted-foreground opacity-0 transition hover:bg-accent hover:text-foreground group-hover:opacity-100"- onClick={(event) => {- event.stopPropagation();- onCloseTerminal(terminalId);- }}- aria-label={`Close ${terminalLabelById.get(terminalId) ?? "terminal"}`}- title={`Close ${terminalLabelById.get(terminalId) ?? "terminal"}`}- >- ×- </button>+ <Popover>+ <PopoverTrigger+ openOnHover+ render={+ <button+ type="button"+ className="inline-flex size-3.5 items-center justify-center rounded text-xs font-medium leading-none text-muted-foreground opacity-0 transition hover:bg-accent hover:text-foreground group-hover:opacity-100"+ onClick={() => onCloseTerminal(terminalId)}+ aria-label={closeTerminalLabel}+ />+ }+ >+ <XIcon className="size-2.5" />+ </PopoverTrigger>+ <PopoverPopup+ tooltipStyle+ side="bottom"+ sideOffset={6}+ align="center"+ className="pointer-events-none select-none"+ >+ {closeTerminalLabel}+ </PopoverPopup>+ </Popover>)}</div>);diff --git a/apps/web/src/keybindings.test.ts b/apps/web/src/keybindings.test.tsindex 25df37f43..2a3b9c324 100644--- a/apps/web/src/keybindings.test.ts+++ b/apps/web/src/keybindings.test.ts@@ -7,9 +7,9 @@ import {type ResolvedKeybindingsConfig,} from "@t3tools/contracts";import {- isChatNewSameGitStateShortcut,formatShortcutLabel,isChatNewShortcut,+ isChatNewLocalShortcut,isOpenFavoriteEditorShortcut,isTerminalClearShortcut,isTerminalCloseShortcut,@@ -91,7 +91,7 @@ const DEFAULT_BINDINGS = compile([whenAst: whenIdentifier("terminalFocus"),},{ shortcut: modShortcut("o", { shiftKey: true }), command: "chat.new" },- { shortcut: modShortcut("n", { shiftKey: true }), command: "chat.newSameGitState" },+ { shortcut: modShortcut("n", { shiftKey: true }), command: "chat.newLocal" },{ shortcut: modShortcut("o"), command: "editor.openFavorite" },]);@@ -245,9 +245,9 @@ describe("chat/editor shortcuts", () => {);});- it("matches chat.newSameGitState shortcut", () => {+ it("matches chat.newLocal shortcut", () => {assert.isTrue(- isChatNewSameGitStateShortcut(+ isChatNewLocalShortcut(event({ key: "n", metaKey: true, shiftKey: true }),DEFAULT_BINDINGS,{@@ -256,7 +256,7 @@ describe("chat/editor shortcuts", () => {),);assert.isTrue(- isChatNewSameGitStateShortcut(+ isChatNewLocalShortcut(event({ key: "n", ctrlKey: true, shiftKey: true }),DEFAULT_BINDINGS,{diff --git a/apps/web/src/keybindings.ts b/apps/web/src/keybindings.tsindex 070dcae67..859602e97 100644--- a/apps/web/src/keybindings.ts+++ b/apps/web/src/keybindings.ts@@ -206,12 +206,12 @@ export function isChatNewShortcut(return matchesCommandShortcut(event, keybindings, "chat.new", options);}-export function isChatNewSameGitStateShortcut(+export function isChatNewLocalShortcut(event: ShortcutEventLike,keybindings: ResolvedKeybindingsConfig,options?: ShortcutMatchOptions,): boolean {- return matchesCommandShortcut(event, keybindings, "chat.newSameGitState", options);+ return matchesCommandShortcut(event, keybindings, "chat.newLocal", options);}export function isOpenFavoriteEditorShortcut(diff --git a/packages/contracts/src/keybindings.test.ts b/packages/contracts/src/keybindings.test.tsindex 7e782a3db..12726ea72 100644--- a/packages/contracts/src/keybindings.test.ts+++ b/packages/contracts/src/keybindings.test.ts@@ -20,6 +20,12 @@ describe("keybindings contracts", () => {command: "terminal.close",});assert.strictEqual(parsedClose.command, "terminal.close");++ const parsedLocal = keybindingRuleSchema.parse({+ key: "mod+shift+n",+ command: "chat.newLocal",+ });+ assert.strictEqual(parsedLocal.command, "chat.newLocal");});it("rejects invalid command values", () => {diff --git a/packages/contracts/src/keybindings.ts b/packages/contracts/src/keybindings.tsindex 62dc84062..d9d8bfbf9 100644--- a/packages/contracts/src/keybindings.ts+++ b/packages/contracts/src/keybindings.ts@@ -6,7 +6,7 @@ export const keybindingCommandSchema = z.enum(["terminal.new","terminal.close","chat.new",- "chat.newSameGitState",+ "chat.newLocal","editor.openFavorite",]);