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 <noreply@anthropic.com>
This commit is contained in:
Prateek 2026-02-18 05:44:59 +05:30
parent 959a564287
commit a5a98cd7aa
6 changed files with 3 additions and 72 deletions

View File

@ -93,7 +93,6 @@ function buildSessionsFromDir(dir: string, projectId: string): Session[] {
vi.mock("../../src/lib/create-session-manager.js", () => ({
getSessionManager: async (): Promise<SessionManager> => mockSessionManager as SessionManager,
getPluginRegistry: vi.fn(),
}));
let tmpDir: string;

View File

@ -66,7 +66,6 @@ vi.mock("@composio/ao-core", async (importOriginal) => {
vi.mock("../../src/lib/create-session-manager.js", () => ({
getSessionManager: async (): Promise<SessionManager> => mockSessionManager as SessionManager,
getPluginRegistry: vi.fn(),
}));
/** Parse a key=value metadata file into a Record<string, string>. */

View File

@ -48,7 +48,6 @@ vi.mock("@composio/ao-core", async (importOriginal) => {
vi.mock("../../src/lib/create-session-manager.js", () => ({
getSessionManager: async (): Promise<SessionManager> => mockSessionManager as SessionManager,
getPluginRegistry: vi.fn(),
}));
vi.mock("../../src/lib/metadata.js", () => ({

View File

@ -150,7 +150,6 @@ function buildSessionsFromDir(
vi.mock("../../src/lib/create-session-manager.js", () => ({
getSessionManager: async (): Promise<SessionManager> => mockSessionManager as SessionManager,
getPluginRegistry: vi.fn(),
}));
let tmpDir: string;

View File

@ -38,9 +38,3 @@ export async function getSessionManager(config: OrchestratorConfig): Promise<Ses
return createSessionManager({ config, registry });
}
/**
* Get the plugin registry directly (for commands that need individual plugins).
*/
export async function getPluginRegistry(config: OrchestratorConfig): Promise<PluginRegistry> {
return getRegistry(config);
}

View File

@ -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<void> {
}
}
/**
* 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<void> {
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"));
}