Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src-tauri/src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,26 @@ async fn get_terminal_session(
}

fn shell_path() -> String {
std::env::var("SHELL").unwrap_or_else(|_| "/bin/zsh".to_string())
if let Ok(shell) = std::env::var("SHELL") {
if !shell.trim().is_empty() {
return shell;
}
}

#[cfg(target_os = "windows")]
{
if let Ok(comspec) = std::env::var("COMSPEC") {
if !comspec.trim().is_empty() {
return comspec;
}
}
return "powershell.exe".to_string();
}

#[cfg(not(target_os = "windows"))]
{
"/bin/zsh".to_string()
}
}

fn resolve_locale() -> String {
Expand Down Expand Up @@ -179,7 +198,6 @@ pub(crate) async fn terminal_open(

let mut cmd = CommandBuilder::new(shell_path());
cmd.cwd(cwd);
cmd.arg("-i");
cmd.env("TERM", "xterm-256color");
let locale = resolve_locale();
cmd.env("LANG", &locale);
Expand Down
13 changes: 8 additions & 5 deletions src/features/threads/hooks/useThreadActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
} from "@utils/threadItems";
import {
asString,
normalizeRootPath,
import {

Check failure on line 27 in src/features/threads/hooks/useThreadActions.ts

View workflow job for this annotation

GitHub Actions / typecheck

',' expected.

Check failure on line 27 in src/features/threads/hooks/useThreadActions.ts

View workflow job for this annotation

GitHub Actions / typecheck

Identifier expected.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0 Badge Fix malformed threadNormalize import

This change introduces a nested import { token inside an existing import clause, which is invalid TypeScript syntax and prevents the file from parsing at all. In practice this blocks all frontend compile paths (typecheck, tests, and app build) in every environment until the import is rewritten as one valid named import from @threads/utils/threadNormalize.

Useful? React with 👍 / 👎.

asString,
normalizeRootPathForCompare,
} from "@threads/utils/threadNormalize";

Check failure on line 30 in src/features/threads/hooks/useThreadActions.ts

View workflow job for this annotation

GitHub Actions / typecheck

';' expected.
import {
getParentThreadIdFromSource,
getResumedActiveTurnId,
} from "@threads/utils/threadRpc";
import { saveThreadActivity } from "@threads/utils/threadStorage";

import type { ThreadAction, ThreadState } from "./useThreadsReducer";

const THREAD_LIST_TARGET_COUNT = 20;
Expand Down Expand Up @@ -380,7 +383,7 @@
) => {
const preserveState = options?.preserveState ?? false;
const requestedSortKey = options?.sortKey ?? threadSortKey;
const workspacePath = normalizeRootPath(workspace.path);
const workspacePath = normalizeRootPathForCompare(workspace.path);
if (!preserveState) {
dispatch({
type: "setThreadListLoading",
Expand Down Expand Up @@ -434,7 +437,7 @@
matchingThreads.push(
...data.filter(
(thread) =>
normalizeRootPath(String(thread?.cwd ?? "")) === workspacePath,
normalizeRootPathForCompare(String(thread?.cwd ?? "")) === workspacePath,
),
);
cursor = nextCursor;
Expand Down Expand Up @@ -581,7 +584,7 @@
if (!nextCursor) {
return;
}
const workspacePath = normalizeRootPath(workspace.path);
const workspacePath = normalizeRootPathForCompare(workspace.path);
const existing = threadsByWorkspace[workspace.id] ?? [];
dispatch({
type: "setThreadListPaging",
Expand Down Expand Up @@ -625,7 +628,7 @@
matchingThreads.push(
...data.filter(
(thread) =>
normalizeRootPath(String(thread?.cwd ?? "")) === workspacePath,
normalizeRootPathForCompare(String(thread?.cwd ?? "")) === workspacePath,
),
);
cursor = next;
Expand Down
8 changes: 8 additions & 0 deletions src/features/threads/utils/threadNormalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ export function normalizeRootPath(value: string) {
return value.replace(/\\/g, "/").replace(/\/+$/, "");
}

export function normalizeRootPathForCompare(value: string) {
const normalized = normalizeRootPath(value);
if (/^(?:[a-zA-Z]:\/|\\\\|\/\/\?\/)/.test(normalized)) {
return normalized.toLowerCase();
}
return normalized;
}

export function extractRpcErrorMessage(response: unknown) {
if (!response || typeof response !== "object") {
return null;
Expand Down
Loading