Skip to content

Commit 439b5f5

Browse files
authored
🤖 Convert all relative imports to absolute paths with @/ alias (#34)
## Summary Converts all relative imports (`../`, `../../`, etc.) to absolute imports using the `@/` alias across the entire codebase. ## Changes Systematically converted imports for all major directories: - `../types/` → `@/types/` - `../utils/` → `@/utils/` - `../services/` → `@/services/` - `../components/` → `@/components/` - `../contexts/` → `@/contexts/` - `../constants/` → `@/constants/` - `../hooks/` → `@/hooks/` - `../styles/` → `@/styles/` **Files affected:** 22 files **Net change:** 0 lines (86 insertions, 86 deletions - pure refactor) ## Benefits - **No more import path hell**: Say goodbye to `../../../types/message` - **Easier refactoring**: Moving files doesn't break dozens of import statements - **Consistency**: All imports follow the same `@/` pattern - **Clarity**: Import paths are clearer and easier to understand - **Maintainability**: New developers can find imports more easily ## Example **Before:** ```typescript import type { CmuxMessage } from "../../../types/message"; import { StreamManager } from "../../services/streamManager"; import { keybinds } from "../utils/keybinds"; ``` **After:** ```typescript import type { CmuxMessage } from "@/types/message"; import { StreamManager } from "@/services/streamManager"; import { keybinds } from "@/utils/keybinds"; ``` ## Testing - ✅ `bun typecheck` passes - ✅ All imports resolve correctly - No functional changes, only import path updates ## Notes This builds on PR #33 which: - Reorganized utils/ into domain-specific subdirectories - Added the @/ path alias configuration _Generated with `cmux`_
1 parent ba9e9b8 commit 439b5f5

22 files changed

+86
-86
lines changed

src/components/AIView.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { MessageRenderer } from "./Messages/MessageRenderer";
44
import { InterruptedBarrier } from "./Messages/InterruptedBarrier";
55
import { ChatInput } from "./ChatInput";
66
import { ChatMetaSidebar } from "./ChatMetaSidebar";
7-
import type { DisplayedMessage, CmuxMessage } from "../types/message";
8-
import { StreamingMessageAggregator } from "../utils/messages/StreamingMessageAggregator";
9-
import { shouldShowInterruptedBarrier } from "../utils/messages/messageUtils";
10-
import { ChatProvider } from "../contexts/ChatContext";
11-
import { ThinkingProvider } from "../contexts/ThinkingContext";
12-
import { ModeProvider } from "../contexts/ModeContext";
13-
import type { WorkspaceChatMessage } from "../types/ipc";
7+
import type { DisplayedMessage, CmuxMessage } from "@/types/message";
8+
import { StreamingMessageAggregator } from "@/utils/messages/StreamingMessageAggregator";
9+
import { shouldShowInterruptedBarrier } from "@/utils/messages/messageUtils";
10+
import { ChatProvider } from "@/contexts/ChatContext";
11+
import { ThinkingProvider } from "@/contexts/ThinkingContext";
12+
import { ModeProvider } from "@/contexts/ModeContext";
13+
import type { WorkspaceChatMessage } from "@/types/ipc";
1414
import {
1515
isCaughtUpMessage,
1616
isStreamError,
@@ -24,7 +24,7 @@ import {
2424
isToolCallEnd,
2525
isReasoningDelta,
2626
isReasoningEnd,
27-
} from "../types/ipc";
27+
} from "@/types/ipc";
2828

2929
// StreamingMessageAggregator is now imported from utils
3030

src/components/ChatInput.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import styled from "@emotion/styled";
33
import { CommandSuggestions, COMMAND_SUGGESTION_KEYS } from "./CommandSuggestions";
44
import type { Toast } from "./ChatInputToast";
55
import { ChatInputToast, SolutionLabel } from "./ChatInputToast";
6-
import type { ParsedCommand } from "../utils/slashCommands/types";
7-
import { parseCommand } from "../utils/slashCommands/parser";
8-
import type { SendMessageError as SendMessageErrorType } from "../types/errors";
9-
import { usePersistedState } from "../hooks/usePersistedState";
6+
import type { ParsedCommand } from "@/utils/slashCommands/types";
7+
import { parseCommand } from "@/utils/slashCommands/parser";
8+
import type { SendMessageError as SendMessageErrorType } from "@/types/errors";
9+
import { usePersistedState } from "@/hooks/usePersistedState";
1010
import { ThinkingSliderComponent } from "./ThinkingSlider";
11-
import { useThinkingLevel } from "../hooks/useThinkingLevel";
12-
import { useMode } from "../contexts/ModeContext";
13-
import { modeToToolPolicy } from "../utils/ui/modeUtils";
11+
import { useThinkingLevel } from "@/hooks/useThinkingLevel";
12+
import { useMode } from "@/contexts/ModeContext";
13+
import { modeToToolPolicy } from "@/utils/ui/modeUtils";
1414
import { ToggleGroup } from "./ToggleGroup";
15-
import type { UIMode } from "../types/mode";
15+
import type { UIMode } from "@/types/mode";
1616
import {
1717
getSlashCommandSuggestions,
1818
type SlashSuggestion,
19-
} from "../utils/slashCommands/suggestions";
19+
} from "@/utils/slashCommands/suggestions";
2020
import { TooltipWrapper, Tooltip, HelpIndicator } from "./Tooltip";
21-
import { matchesKeybind, formatKeybind, KEYBINDS } from "../utils/ui/keybinds";
21+
import { matchesKeybind, formatKeybind, KEYBINDS } from "@/utils/ui/keybinds";
2222

2323
const InputSection = styled.div`
2424
position: relative;

src/components/ChatMetaSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import styled from "@emotion/styled";
3-
import { usePersistedState } from "../hooks/usePersistedState";
3+
import { usePersistedState } from "@/hooks/usePersistedState";
44
import { CostsTab } from "./ChatMetaSidebar/CostsTab";
55
import { ToolsTab } from "./ChatMetaSidebar/ToolsTab";
66

src/components/CommandSuggestions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from "react";
22
import styled from "@emotion/styled";
3-
import type { SlashSuggestion } from "../utils/slashCommands/types";
3+
import type { SlashSuggestion } from "@/utils/slashCommands/types";
44

55
// Export the keys that CommandSuggestions handles
66
export const COMMAND_SUGGESTION_KEYS = ["Tab", "ArrowUp", "ArrowDown", "Escape"];

src/components/NewWorkspaceModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect, useCallback } from "react";
22
import styled from "@emotion/styled";
3-
import { matchesKeybind, KEYBINDS } from "../utils/ui/keybinds";
3+
import { matchesKeybind, KEYBINDS } from "@/utils/ui/keybinds";
44

55
// Styled Components
66
const ModalOverlay = styled.div`

src/components/ProjectSidebar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React, { useState, useEffect } from "react";
22
import styled from "@emotion/styled";
33
import { css } from "@emotion/react";
44
import type { ProjectConfig } from "../config";
5-
import type { WorkspaceMetadata } from "../types/workspace";
6-
import { usePersistedState } from "../hooks/usePersistedState";
7-
import { matchesKeybind, formatKeybind, KEYBINDS } from "../utils/ui/keybinds";
8-
import { abbreviatePath } from "../utils/ui/pathAbbreviation";
5+
import type { WorkspaceMetadata } from "@/types/workspace";
6+
import { usePersistedState } from "@/hooks/usePersistedState";
7+
import { matchesKeybind, formatKeybind, KEYBINDS } from "@/utils/ui/keybinds";
8+
import { abbreviatePath } from "@/utils/ui/pathAbbreviation";
99
import { TooltipWrapper, Tooltip } from "./Tooltip";
1010

1111
// Styled Components

src/components/ThinkingSlider.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import styled from "@emotion/styled";
3-
import type { ThinkingLevel } from "../types/thinking";
4-
import { useThinkingLevel } from "../hooks/useThinkingLevel";
3+
import type { ThinkingLevel } from "@/types/thinking";
4+
import { useThinkingLevel } from "@/hooks/useThinkingLevel";
55

66
const ThinkingSliderContainer = styled.div`
77
display: flex;

src/contexts/ChatContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { ReactNode } from "react";
22
import React, { createContext, useContext, useState, useEffect, useRef } from "react";
3-
import type { CmuxMessage, DisplayedMessage } from "../types/message";
4-
import type { ChatStats } from "../types/chatStats";
5-
import { TokenStatsWorker } from "../utils/tokens/TokenStatsWorker";
3+
import type { CmuxMessage, DisplayedMessage } from "@/types/message";
4+
import type { ChatStats } from "@/types/chatStats";
5+
import { TokenStatsWorker } from "@/utils/tokens/TokenStatsWorker";
66

77
interface ChatContextType {
88
messages: DisplayedMessage[];

src/contexts/ModeContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { ReactNode } from "react";
22
import React, { createContext, useContext, useEffect } from "react";
3-
import type { UIMode } from "../types/mode";
4-
import { usePersistedState } from "../hooks/usePersistedState";
5-
import { matchesKeybind, KEYBINDS } from "../utils/ui/keybinds";
3+
import type { UIMode } from "@/types/mode";
4+
import { usePersistedState } from "@/hooks/usePersistedState";
5+
import { matchesKeybind, KEYBINDS } from "@/utils/ui/keybinds";
66

77
type ModeContextType = [UIMode, (mode: UIMode) => void];
88

src/contexts/ThinkingContext.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ReactNode } from "react";
22
import React, { createContext, useContext } from "react";
3-
import type { ThinkingLevel } from "../types/thinking";
4-
import { usePersistedState } from "../hooks/usePersistedState";
3+
import type { ThinkingLevel } from "@/types/thinking";
4+
import { usePersistedState } from "@/hooks/usePersistedState";
55

66
interface ThinkingContextType {
77
thinkingLevel: ThinkingLevel;

0 commit comments

Comments
 (0)