episoda 0.2.59 → 0.2.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2726,7 +2726,7 @@ var require_package = __commonJS({
2726
2726
  "package.json"(exports2, module2) {
2727
2727
  module2.exports = {
2728
2728
  name: "episoda",
2729
- version: "0.2.59",
2729
+ version: "0.2.62",
2730
2730
  description: "CLI tool for Episoda local development workflow orchestration",
2731
2731
  main: "dist/index.js",
2732
2732
  types: "dist/index.d.ts",
@@ -7242,6 +7242,7 @@ var WorktreeManager = class _WorktreeManager {
7242
7242
  /**
7243
7243
  * Remove a worktree for a module
7244
7244
  * P1-2: Wrapped entire operation in lock to prevent race with createWorktree
7245
+ * EP1070: Clean build caches before git worktree remove to prevent orphaned directories
7245
7246
  */
7246
7247
  async removeWorktree(moduleUid, force = false) {
7247
7248
  if (!validateModuleUid(moduleUid)) {
@@ -7265,6 +7266,7 @@ var WorktreeManager = class _WorktreeManager {
7265
7266
  error: `No worktree found for module ${moduleUid}`
7266
7267
  };
7267
7268
  }
7269
+ await this.cleanBuildCaches(existing.worktreePath);
7268
7270
  const result = await this.gitExecutor.execute({
7269
7271
  action: "worktree_remove",
7270
7272
  path: existing.worktreePath,
@@ -7489,6 +7491,37 @@ var WorktreeManager = class _WorktreeManager {
7489
7491
  } catch {
7490
7492
  }
7491
7493
  }
7494
+ /**
7495
+ * EP1070: Clean build caches before worktree removal
7496
+ *
7497
+ * Removes common build cache directories that can cause:
7498
+ * 1. git worktree remove to fail (locked files on Windows)
7499
+ * 2. Orphaned directories if removal partially fails
7500
+ * 3. Disk space waste from abandoned build artifacts
7501
+ *
7502
+ * @param worktreePath - Absolute path to the worktree directory
7503
+ */
7504
+ async cleanBuildCaches(worktreePath) {
7505
+ const cacheDirs = [
7506
+ ".next",
7507
+ // Next.js build cache
7508
+ "node_modules/.cache",
7509
+ // Various build tool caches (babel, eslint, etc.)
7510
+ ".turbo"
7511
+ // Turborepo cache
7512
+ ];
7513
+ for (const cacheDir of cacheDirs) {
7514
+ const cachePath = path16.join(worktreePath, cacheDir);
7515
+ try {
7516
+ if (fs15.existsSync(cachePath)) {
7517
+ console.log(`[WorktreeManager] EP1070: Cleaning build cache: ${cacheDir}`);
7518
+ fs15.rmSync(cachePath, { recursive: true, force: true });
7519
+ }
7520
+ } catch (error) {
7521
+ console.warn(`[WorktreeManager] EP1070: Failed to clean ${cacheDir} (non-blocking):`, error.message);
7522
+ }
7523
+ }
7524
+ }
7492
7525
  readConfig() {
7493
7526
  try {
7494
7527
  if (!fs15.existsSync(this.configPath)) {
@@ -9276,7 +9309,7 @@ var Daemon = class _Daemon {
9276
9309
  return;
9277
9310
  }
9278
9311
  const data = await response.json();
9279
- const tasks = data.data?.tasks || [];
9312
+ const tasks = data.tasks || [];
9280
9313
  if (tasks.length === 0) {
9281
9314
  console.log("[Daemon] EP1051: No pending background operations");
9282
9315
  return;