Skip to content

Commit 6168451

Browse files
committed
🤖 refactor: Phase 8 - Fix all import paths across codebase
- Fixed relative imports in browser/ (App.tsx, App.stories.tsx, components) - Fixed relative imports in desktop/ (main.ts, preload.ts) - Fixed relative imports in cli/ (server.ts, debug/) - Fixed dynamic import() statements - Fixed test imports throughout tests/ - Updated telemetry imports across all layers Result: Only 1 pre-existing TS1378 error (top-level await in cli/debug) All refactor-related import errors resolved. Part of comprehensive src/ reorganization. _Generated with `mux`_
1 parent 47a8de2 commit 6168451

35 files changed

+118
-118
lines changed

src/browser/App.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { Meta, StoryObj } from "@storybook/react-vite";
22
import { useRef } from "react";
33
import { AppLoader } from "./components/AppLoader";
4-
import type { ProjectConfig } from "./config";
5-
import type { FrontendWorkspaceMetadata } from "./types/workspace";
6-
import type { IPCApi } from "./types/ipc";
7-
import type { ChatStats } from "./types/chatStats";
4+
import type { ProjectConfig } from "@/node/config";
5+
import type { FrontendWorkspaceMetadata } from "@/common/types/workspace";
6+
import type { IPCApi } from "@/common/types/ipc";
7+
import type { ChatStats } from "@/common/types/chatStats";
88
import { DEFAULT_RUNTIME_CONFIG } from "@/common/constants/workspace";
99

1010
// Stable timestamp for testing active states (use fixed time minus small offsets)

src/browser/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import "./styles/globals.css";
33
import { useWorkspaceContext } from "./contexts/WorkspaceContext";
44
import { useProjectContext } from "./contexts/ProjectContext";
55
import type { WorkspaceSelection } from "./components/ProjectSidebar";
6-
import type { FrontendWorkspaceMetadata } from "./types/workspace";
6+
import type { FrontendWorkspaceMetadata } from "@/common/types/workspace";
77
import { LeftSidebar } from "./components/LeftSidebar";
88
import { ProjectCreateModal } from "./components/ProjectCreateModal";
99
import { AIView } from "./components/AIView";
@@ -25,11 +25,11 @@ import { ThinkingProvider } from "./contexts/ThinkingContext";
2525
import { CommandPalette } from "./components/CommandPalette";
2626
import { buildCoreSources, type BuildSourcesParams } from "./utils/commands/sources";
2727

28-
import type { ThinkingLevel } from "./types/thinking";
29-
import { CUSTOM_EVENTS } from "./constants/events";
28+
import type { ThinkingLevel } from "@/common/types/thinking";
29+
import { CUSTOM_EVENTS } from "@/common/constants/events";
3030
import { isWorkspaceForkSwitchEvent } from "./utils/workspaceFork";
31-
import { getThinkingLevelKey } from "./constants/storage";
32-
import type { BranchListResult } from "./types/ipc";
31+
import { getThinkingLevelKey } from "@/common/constants/storage";
32+
import type { BranchListResult } from "@/common/types/ipc";
3333
import { useTelemetry } from "./hooks/useTelemetry";
3434
import { useStartWorkspaceCreation, getFirstProjectPath } from "./hooks/useStartWorkspaceCreation";
3535

src/browser/components/ChatInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
import type { ThinkingLevel } from "@/common/types/thinking";
5454
import type { MuxFrontendMetadata } from "@/common/types/message";
5555
import { useTelemetry } from "@/browser/hooks/useTelemetry";
56-
import { setTelemetryEnabled } from "@/telemetry";
56+
import { setTelemetryEnabled } from "@/node/telemetry";
5757
import { getTokenCountPromise } from "@/browser/utils/tokenizer/rendererClient";
5858
import { CreationCenterContent } from "./CreationCenterContent";
5959
import { CreationControls } from "./CreationControls";

src/browser/components/TitleBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { cn } from "@/common/lib/utils";
33
import { VERSION } from "@/version";
44
import { TooltipWrapper, Tooltip } from "./Tooltip";
55
import type { UpdateStatus } from "@/common/types/ipc";
6-
import { isTelemetryEnabled } from "@/telemetry";
6+
import { isTelemetryEnabled } from "@/node/telemetry";
77

88
// Update check intervals
99
const UPDATE_CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000; // 4 hours

src/browser/hooks/useTelemetry.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useCallback } from "react";
2-
import { trackEvent, getBaseTelemetryProperties, roundToBase2 } from "../telemetry";
3-
import type { ErrorContext } from "../telemetry/payload";
2+
import { trackEvent, getBaseTelemetryProperties, roundToBase2 } from "@/node/telemetry";
3+
import type { ErrorContext } from "@/node/telemetry/payload";
44

55
/**
66
* Hook for clean telemetry integration in React components

src/cli/debug/agentSessionCli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import assert from "@/common/utils/assert";
44
import * as fs from "fs/promises";
55
import * as path from "path";
6-
import { PlatformPaths } from "../utils/paths";
6+
import { PlatformPaths } from "@/common/utils/paths";
77
import { parseArgs } from "util";
88
import { Config } from "@/node/config";
99
import { HistoryService } from "@/node/services/historyService";
@@ -27,7 +27,7 @@ import {
2727
import { getDefaultModelFromLRU } from "@/browser/hooks/useModelLRU";
2828
import { ensureProvidersConfig } from "@/common/utils/providers/ensureProvidersConfig";
2929
import { modeToToolPolicy, PLAN_MODE_INSTRUCTION } from "@/browser/utils/ui/modeUtils";
30-
import { extractAssistantText, extractReasoning, extractToolCalls } from "@/debug/chatExtractors";
30+
import { extractAssistantText, extractReasoning, extractToolCalls } from "@/cli/debug/chatExtractors";
3131
import type { ThinkingLevel } from "@/common/types/thinking";
3232

3333
interface CliResult {

src/cli/debug/git-status.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { join } from "path";
1111
import { execSync } from "child_process";
1212

1313
// Import production code - script and parser stay in sync
14-
import { GIT_STATUS_SCRIPT, parseGitStatusScriptOutput } from "../utils/git/gitStatus";
15-
import { parseGitShowBranchForStatus } from "../utils/git/parseGitStatus";
16-
import { getMuxSrcDir } from "../constants/paths";
14+
import { GIT_STATUS_SCRIPT, parseGitStatusScriptOutput } from "@/node/utils/git/gitStatus";
15+
import { parseGitShowBranchForStatus } from "@/node/utils/git/parseGitStatus";
16+
import { getMuxSrcDir } from "@/common/constants/paths";
1717

1818
function findWorkspaces(): Array<{ id: string; path: string }> {
1919
const workspaces: Array<{ id: string; path: string }> = [];

src/cli/debug/list-workspaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defaultConfig } from "@/node/config";
2-
import { PlatformPaths } from "../utils/paths";
2+
import { PlatformPaths } from "@/common/utils/paths";
33
import * as fs from "fs";
44
import { getMuxSessionsDir } from "@/common/constants/paths";
55

src/cli/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* HTTP/WebSocket Server for mux
33
* Allows accessing mux backend from mobile devices
44
*/
5-
import { Config } from "./config";
5+
import { Config } from "@/node/config";
66
import { IPC_CHANNELS } from "@/common/constants/ipc-constants";
7-
import { IpcMain } from "./services/ipcMain";
8-
import { migrateCmuxToMux } from "./constants/paths";
7+
import { IpcMain } from "@/node/services/ipcMain";
8+
import { migrateCmuxToMux } from "@/common/constants/paths";
99
import cors from "cors";
1010
import type { BrowserWindow, IpcMain as ElectronIpcMain } from "electron";
1111
import express from "express";
@@ -14,7 +14,7 @@ import * as path from "path";
1414
import type { RawData } from "ws";
1515
import { WebSocket, WebSocketServer } from "ws";
1616
import { Command } from "commander";
17-
import { validateProjectPath } from "./utils/pathUtils";
17+
import { validateProjectPath } from "@/node/utils/pathUtils";
1818

1919
// Parse command line arguments
2020
const program = new Command();

src/desktop/main.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ import {
1414
} from "electron";
1515
import * as fs from "fs";
1616
import * as path from "path";
17-
import type { Config } from "./config";
18-
import type { IpcMain } from "./services/ipcMain";
19-
import { VERSION } from "./version";
20-
import { IPC_CHANNELS } from "./constants/ipc-constants";
21-
import { getMuxHome, migrateCmuxToMux } from "./constants/paths";
22-
import { log } from "./services/log";
23-
import { parseDebugUpdater } from "./utils/env";
24-
import assert from "./utils/assert";
25-
import { loadTokenizerModules } from "./utils/main/tokenizer";
17+
import type { Config } from "@/node/config";
18+
import type { IpcMain } from "@/node/services/ipcMain";
19+
import { VERSION } from "@/version";
20+
import { IPC_CHANNELS } from "@/common/constants/ipc-constants";
21+
import { getMuxHome, migrateCmuxToMux } from "@/common/constants/paths";
22+
import { log } from "@/node/services/log";
23+
import { parseDebugUpdater } from "@/common/utils/env";
24+
import assert from "@/common/utils/assert";
25+
import { loadTokenizerModules } from "@/node/utils/main/tokenizer";
2626

2727
// React DevTools for development profiling
2828
// Using require() instead of import since it's dev-only and conditionally loaded
@@ -69,7 +69,7 @@ if (!app.isPackaged) {
6969
let config: Config | null = null;
7070
let ipcMain: IpcMain | null = null;
7171
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
72-
let updaterService: typeof import("./services/updater").UpdaterService.prototype | null = null;
72+
let updaterService: typeof import("@/desktop/updater").UpdaterService.prototype | null = null;
7373
const isE2ETest = process.env.MUX_E2E === "1";
7474
const forceDistLoad = process.env.MUX_E2E_LOAD_DIST === "1";
7575

@@ -310,10 +310,10 @@ async function loadServices(): Promise<void> {
310310
{ UpdaterService: UpdaterServiceClass },
311311
{ TerminalWindowManager: TerminalWindowManagerClass },
312312
] = await Promise.all([
313-
import("./config"),
314-
import("./services/ipcMain"),
315-
import("./services/updater"),
316-
import("./services/terminalWindowManager"),
313+
import("@/node/config"),
314+
import("@/node/services/ipcMain"),
315+
import("@/desktop/updater"),
316+
import("@/desktop/terminalWindowManager"),
317317
]);
318318
/* eslint-enable no-restricted-syntax */
319319
config = new ConfigClass();

0 commit comments

Comments
 (0)