## Summary Wave 17 organizes Fusion into **domain folders** (stacks on #2397). ### Layout - **core/types/** — board, task, agents, settings, merge, workflow, mesh, … - **core/src/** — agents, ai, async-stores, workflows, tasks, config, db, … - **dashboard/app/api/** — client, tasks, agents, git, missions, planning, … - **engine/src/** — agents, auth, execution, merge, missions, overseer, worktree, … Root keepers retained for large entrypoints (`store.ts`, `executor.ts`, `merger.ts`, …). Public barrels (`@fusion/core`, `@fusion/engine`, `app/api.ts` → legacy) stay stable. ## Test plan - [x] `@fusion/core` typecheck - [x] `@fusion/engine` typecheck (pre-existing playwright-core noise only) - [ ] CI merge gate **Stack:** #2394 → #2397 → **this PR**
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { existsSync } from "node:fs";
|
|
import { rm } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
|
|
export const DESKTOP_ARTIFACT_RELATIVE_PATHS = ["packages/desktop/dist", "packages/desktop/dist-electron"] as const;
|
|
|
|
type CleanupLogger = {
|
|
log: (message: string) => void;
|
|
warn: (message: string) => void;
|
|
};
|
|
|
|
export async function removeDesktopBuildArtifacts(
|
|
worktreePath: string,
|
|
logger?: CleanupLogger,
|
|
): Promise<{ removed: string[]; skipped: string[]; failures: Array<{ path: string; error: string }> }> {
|
|
const removed: string[] = [];
|
|
const skipped: string[] = [];
|
|
const failures: Array<{ path: string; error: string }> = [];
|
|
|
|
if (!worktreePath) {
|
|
logger?.warn?.("Desktop artifact cleanup skipped: missing worktree path");
|
|
return { removed, skipped, failures };
|
|
}
|
|
|
|
for (const relativePath of DESKTOP_ARTIFACT_RELATIVE_PATHS) {
|
|
const absolutePath = resolve(worktreePath, relativePath);
|
|
if (!existsSync(absolutePath)) {
|
|
skipped.push(relativePath);
|
|
continue;
|
|
}
|
|
|
|
try {
|
|
await rm(absolutePath, { recursive: true, force: true });
|
|
removed.push(relativePath);
|
|
logger?.log?.(`Removed desktop build artifact directory: ${relativePath}`);
|
|
} catch (error) {
|
|
const message = error instanceof Error ? error.message : String(error);
|
|
failures.push({ path: relativePath, error: message });
|
|
logger?.warn?.(`Failed to remove desktop build artifact directory ${relativePath}: ${message}`);
|
|
}
|
|
}
|
|
|
|
return { removed, skipped, failures };
|
|
}
|