Skip to content

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.

Fix terminal stability bugs: remove autoFocus from effect deps, stabilize memo, remove dead export

Cursor Agent0e73dc15275f
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 1fd660c88..27904e29e 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -552,7 +552,7 @@ export default function ChatView() {
},
worktreePath: activeThread?.worktreePath ?? null,
});
- }, [activeProject, activeThread?.worktreePath]);
+ }, [activeProject?.cwd, activeThread?.worktreePath]);
// Default true while loading to avoid toolbar flicker.
const isGitRepo = branchesQuery.data?.isRepo ?? true;
const splitTerminalShortcutLabel = useMemo(
diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx
index 5d5c377fa..c065d67a5 100644
--- a/apps/web/src/components/ThreadTerminalDrawer.tsx
+++ b/apps/web/src/components/ThreadTerminalDrawer.tsx
@@ -372,7 +372,7 @@ function TerminalViewport({
fitAddonRef.current = null;
terminal.dispose();
};
- }, [api, autoFocus, cwd, runtimeEnv, terminalId, threadId]);
+ }, [api, cwd, runtimeEnv, terminalId, threadId]);
useEffect(() => {
if (!autoFocus) return;
diff --git a/apps/web/src/projectScripts.test.ts b/apps/web/src/projectScripts.test.ts
index 525513446..dadc22a47 100644
--- a/apps/web/src/projectScripts.test.ts
+++ b/apps/web/src/projectScripts.test.ts
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vitest";
import {
commandForProjectScript,
- injectEnvIntoShellCommand,
nextProjectScriptId,
primaryProjectScript,
projectScriptRuntimeEnv,
@@ -24,25 +23,6 @@ describe("projectScripts helpers", () => {
expect(nextProjectScriptId("!!!", [])).toBe("script");
});
- it("injects environment variables for posix shells", () => {
- const command = injectEnvIntoShellCommand("bun install", { T3CODE_PROJECT_ROOT: "/tmp/project" }, "MacIntel");
- expect(command).toBe("env T3CODE_PROJECT_ROOT='/tmp/project' bun install");
- });
-
- it("injects environment variables for windows shells", () => {
- const command = injectEnvIntoShellCommand("bun install", { T3CODE_PROJECT_ROOT: "C:\\\\repo path" }, "Win32");
- expect(command).toBe('set "T3CODE_PROJECT_ROOT=C:\\\\repo path" && bun install');
- });
-
- it("escapes windows env values that trigger interpolation", () => {
- const command = injectEnvIntoShellCommand(
- "bun install",
- { T3CODE_PROJECT_ROOT: '%USERPROFILE%^"repo"' },
- "Win32",
- );
- expect(command).toBe('set "T3CODE_PROJECT_ROOT=^%USERPROFILE^%^^""repo""" && bun install');
- });
-
it("resolves primary and setup scripts", () => {
const scripts = [
{
diff --git a/apps/web/src/projectScripts.ts b/apps/web/src/projectScripts.ts
index 15d0790a7..c09a80123 100644
--- a/apps/web/src/projectScripts.ts
+++ b/apps/web/src/projectScripts.ts
@@ -60,7 +60,7 @@ function shellEscapeWindowsSetValue(value: string): string {
return value.replace(/\^/g, "^^").replace(/%/g, "^%").replace(/"/g, '""');
}
-export function injectEnvIntoShellCommand(
+function injectEnvIntoShellCommand(
command: string,
env: Record<string, string>,
platform = typeof navigator === "undefined" ? "" : navigator.platform,