From a5a98cd7aa6e77d82bfdbb2c062121aa93bafee5 Mon Sep 17 00:00:00 2001 From: Prateek Date: Wed, 18 Feb 2026 05:44:59 +0530 Subject: [PATCH] chore: remove dead exports getPluginRegistry and rebuildDashboard Both functions were exported but never imported outside test mocks. Clean up test mocks and unused imports accordingly. Co-Authored-By: Claude Sonnet 4.6 --- .../__tests__/commands/review-check.test.ts | 1 - .../cli/__tests__/commands/session.test.ts | 1 - packages/cli/__tests__/commands/spawn.test.ts | 1 - .../cli/__tests__/commands/status.test.ts | 1 - .../cli/src/lib/create-session-manager.ts | 6 -- packages/cli/src/lib/dashboard-rebuild.ts | 65 +------------------ 6 files changed, 3 insertions(+), 72 deletions(-) diff --git a/packages/cli/__tests__/commands/review-check.test.ts b/packages/cli/__tests__/commands/review-check.test.ts index 657b20685..3cd28d25d 100644 --- a/packages/cli/__tests__/commands/review-check.test.ts +++ b/packages/cli/__tests__/commands/review-check.test.ts @@ -93,7 +93,6 @@ function buildSessionsFromDir(dir: string, projectId: string): Session[] { vi.mock("../../src/lib/create-session-manager.js", () => ({ getSessionManager: async (): Promise => mockSessionManager as SessionManager, - getPluginRegistry: vi.fn(), })); let tmpDir: string; diff --git a/packages/cli/__tests__/commands/session.test.ts b/packages/cli/__tests__/commands/session.test.ts index c76345a48..8c3cbac51 100644 --- a/packages/cli/__tests__/commands/session.test.ts +++ b/packages/cli/__tests__/commands/session.test.ts @@ -66,7 +66,6 @@ vi.mock("@composio/ao-core", async (importOriginal) => { vi.mock("../../src/lib/create-session-manager.js", () => ({ getSessionManager: async (): Promise => mockSessionManager as SessionManager, - getPluginRegistry: vi.fn(), })); /** Parse a key=value metadata file into a Record. */ diff --git a/packages/cli/__tests__/commands/spawn.test.ts b/packages/cli/__tests__/commands/spawn.test.ts index 1bd22d3f3..a4abc1824 100644 --- a/packages/cli/__tests__/commands/spawn.test.ts +++ b/packages/cli/__tests__/commands/spawn.test.ts @@ -48,7 +48,6 @@ vi.mock("@composio/ao-core", async (importOriginal) => { vi.mock("../../src/lib/create-session-manager.js", () => ({ getSessionManager: async (): Promise => mockSessionManager as SessionManager, - getPluginRegistry: vi.fn(), })); vi.mock("../../src/lib/metadata.js", () => ({ diff --git a/packages/cli/__tests__/commands/status.test.ts b/packages/cli/__tests__/commands/status.test.ts index 4e8c8d863..57f0f9787 100644 --- a/packages/cli/__tests__/commands/status.test.ts +++ b/packages/cli/__tests__/commands/status.test.ts @@ -150,7 +150,6 @@ function buildSessionsFromDir( vi.mock("../../src/lib/create-session-manager.js", () => ({ getSessionManager: async (): Promise => mockSessionManager as SessionManager, - getPluginRegistry: vi.fn(), })); let tmpDir: string; diff --git a/packages/cli/src/lib/create-session-manager.ts b/packages/cli/src/lib/create-session-manager.ts index 8cc54c59f..c40e2896f 100644 --- a/packages/cli/src/lib/create-session-manager.ts +++ b/packages/cli/src/lib/create-session-manager.ts @@ -38,9 +38,3 @@ export async function getSessionManager(config: OrchestratorConfig): Promise { - return getRegistry(config); -} diff --git a/packages/cli/src/lib/dashboard-rebuild.ts b/packages/cli/src/lib/dashboard-rebuild.ts index 4e0bc8c3a..cc0698a25 100644 --- a/packages/cli/src/lib/dashboard-rebuild.ts +++ b/packages/cli/src/lib/dashboard-rebuild.ts @@ -1,34 +1,12 @@ /** - * Dashboard rebuild utility — cleans stale build artifacts and rebuilds. - * - * Handles three common failure modes: - * 1. Stale .next cache (e.g., missing vendor-chunks after dependency changes) - * 2. Missing node_modules in web package - * 3. Missing built packages (core/plugins not compiled) + * Dashboard cache utilities — cleans stale .next artifacts and detects + * running dashboard processes. */ import { resolve } from "node:path"; import { existsSync, rmSync } from "node:fs"; -import chalk from "chalk"; import ora from "ora"; -import { exec, execSilent } from "./shell.js"; - -/** - * Find the monorepo root by walking up from the web directory. - * Looks for pnpm-workspace.yaml as the marker. - */ -function findMonorepoRoot(webDir: string): string | null { - let dir = resolve(webDir); - for (let i = 0; i < 10; i++) { - if (existsSync(resolve(dir, "pnpm-workspace.yaml"))) { - return dir; - } - const parent = resolve(dir, ".."); - if (parent === dir) break; - dir = parent; - } - return null; -} +import { execSilent } from "./shell.js"; /** * Find the PID of a process listening on the given port. @@ -92,40 +70,3 @@ export async function cleanNextCache(webDir: string): Promise { } } -/** - * Clean stale .next cache and rebuild all packages. - * Use when NO dev server is running — starts fresh with a full build. - */ -export async function rebuildDashboard(webDir: string): Promise { - const nextDir = resolve(webDir, ".next"); - const spinner = ora(); - - console.log(chalk.dim(` Rebuilding: ${webDir}\n`)); - - // Step 1: Clean .next cache - if (existsSync(nextDir)) { - spinner.start("Cleaning .next build cache"); - rmSync(nextDir, { recursive: true, force: true }); - spinner.succeed("Cleaned .next build cache"); - } - - // Step 2: Ensure node_modules exist - if (!existsSync(resolve(webDir, "node_modules"))) { - const root = findMonorepoRoot(webDir); - if (root) { - spinner.start("Installing dependencies (pnpm install)"); - await exec("pnpm", ["install"], { cwd: root }); - spinner.succeed("Dependencies installed"); - } - } - - // Step 3: Build workspace packages (core + plugins) - const root = findMonorepoRoot(webDir); - if (root) { - spinner.start("Building packages (pnpm build)"); - await exec("pnpm", ["build"], { cwd: root }); - spinner.succeed("Packages built"); - } - - console.log(chalk.green("\nRebuild complete.\n")); -}