episoda 0.2.97 → 0.2.98
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.
- package/dist/daemon/daemon-process.js +67 -2
- package/dist/daemon/daemon-process.js.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2786,7 +2786,7 @@ var require_package = __commonJS({
|
|
|
2786
2786
|
"package.json"(exports2, module2) {
|
|
2787
2787
|
module2.exports = {
|
|
2788
2788
|
name: "episoda",
|
|
2789
|
-
version: "0.2.
|
|
2789
|
+
version: "0.2.98",
|
|
2790
2790
|
description: "CLI tool for Episoda local development workflow orchestration",
|
|
2791
2791
|
main: "dist/index.js",
|
|
2792
2792
|
types: "dist/index.d.ts",
|
|
@@ -4406,6 +4406,48 @@ var WorktreeManager = class _WorktreeManager {
|
|
|
4406
4406
|
}
|
|
4407
4407
|
return { valid, stale, orphaned };
|
|
4408
4408
|
}
|
|
4409
|
+
/**
|
|
4410
|
+
* EP1190: Clean up non-module worktrees (like 'main')
|
|
4411
|
+
*
|
|
4412
|
+
* In K1273 per-user-per-workspace model, only EP### worktrees should exist.
|
|
4413
|
+
* The 'main' worktree and other non-module worktrees are legacy artifacts
|
|
4414
|
+
* that can contain stale code and should be removed.
|
|
4415
|
+
*
|
|
4416
|
+
* @returns Object with removed paths and errors
|
|
4417
|
+
*/
|
|
4418
|
+
async cleanupNonModuleWorktrees() {
|
|
4419
|
+
const removed = [];
|
|
4420
|
+
const errors = [];
|
|
4421
|
+
try {
|
|
4422
|
+
const validation = await this.validateWorktrees();
|
|
4423
|
+
for (const orphanPath of validation.orphaned) {
|
|
4424
|
+
const dirName = path7.basename(orphanPath);
|
|
4425
|
+
const isModuleWorktree = /^EP\d+$/.test(dirName);
|
|
4426
|
+
if (!isModuleWorktree) {
|
|
4427
|
+
console.log(`[WorktreeManager] EP1190: Found non-module worktree: ${dirName}`);
|
|
4428
|
+
try {
|
|
4429
|
+
const removeResult = await this.gitExecutor.execute({
|
|
4430
|
+
action: "worktree_remove",
|
|
4431
|
+
path: orphanPath,
|
|
4432
|
+
force: true
|
|
4433
|
+
// Force removal since it's not tracked
|
|
4434
|
+
}, { cwd: this.bareRepoPath });
|
|
4435
|
+
if (removeResult.success) {
|
|
4436
|
+
removed.push(dirName);
|
|
4437
|
+
console.log(`[WorktreeManager] EP1190: Removed non-module worktree: ${dirName}`);
|
|
4438
|
+
} else {
|
|
4439
|
+
errors.push(`Failed to remove ${dirName}: ${removeResult.output}`);
|
|
4440
|
+
}
|
|
4441
|
+
} catch (removeError) {
|
|
4442
|
+
errors.push(`Error removing ${dirName}: ${removeError.message}`);
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
} catch (error) {
|
|
4447
|
+
errors.push(`Validation error: ${error.message}`);
|
|
4448
|
+
}
|
|
4449
|
+
return { removed, errors };
|
|
4450
|
+
}
|
|
4409
4451
|
/**
|
|
4410
4452
|
* Get project configuration
|
|
4411
4453
|
*/
|
|
@@ -9425,7 +9467,6 @@ async function fetchEnvVars2() {
|
|
|
9425
9467
|
}
|
|
9426
9468
|
}
|
|
9427
9469
|
var Daemon = class _Daemon {
|
|
9428
|
-
// 60 seconds
|
|
9429
9470
|
constructor() {
|
|
9430
9471
|
this.machineId = "";
|
|
9431
9472
|
this.machineUuid = null;
|
|
@@ -9464,6 +9505,9 @@ var Daemon = class _Daemon {
|
|
|
9464
9505
|
// Health checks are orthogonal to push-based state sync - they detect dead tunnels
|
|
9465
9506
|
this.healthCheckInterval = null;
|
|
9466
9507
|
this.healthCheckInProgress = false;
|
|
9508
|
+
// 60 seconds
|
|
9509
|
+
// EP1190: Worktree cleanup runs every N health checks (5 * 60s = 5 minutes)
|
|
9510
|
+
this.healthCheckCounter = 0;
|
|
9467
9511
|
this.ipcServer = new IPCServer();
|
|
9468
9512
|
}
|
|
9469
9513
|
static {
|
|
@@ -9480,6 +9524,9 @@ var Daemon = class _Daemon {
|
|
|
9480
9524
|
static {
|
|
9481
9525
|
this.HEALTH_CHECK_INTERVAL_MS = 6e4;
|
|
9482
9526
|
}
|
|
9527
|
+
static {
|
|
9528
|
+
this.WORKTREE_CLEANUP_EVERY_N_CHECKS = 5;
|
|
9529
|
+
}
|
|
9483
9530
|
/**
|
|
9484
9531
|
* Start the daemon
|
|
9485
9532
|
*/
|
|
@@ -11217,6 +11264,11 @@ var Daemon = class _Daemon {
|
|
|
11217
11264
|
if (config?.access_token) {
|
|
11218
11265
|
await this.performHealthChecks(config);
|
|
11219
11266
|
}
|
|
11267
|
+
this.healthCheckCounter++;
|
|
11268
|
+
if (this.healthCheckCounter >= _Daemon.WORKTREE_CLEANUP_EVERY_N_CHECKS) {
|
|
11269
|
+
this.healthCheckCounter = 0;
|
|
11270
|
+
await this.auditWorktreesOnStartup();
|
|
11271
|
+
}
|
|
11220
11272
|
} catch (error) {
|
|
11221
11273
|
console.error("[Daemon] EP929: Health check error:", error instanceof Error ? error.message : error);
|
|
11222
11274
|
} finally {
|
|
@@ -11403,6 +11455,19 @@ var Daemon = class _Daemon {
|
|
|
11403
11455
|
console.warn("[Daemon] EP1035: Failed to prune stale worktrees:", pruneError.message);
|
|
11404
11456
|
}
|
|
11405
11457
|
}
|
|
11458
|
+
try {
|
|
11459
|
+
const cleanupResult = await manager.cleanupNonModuleWorktrees();
|
|
11460
|
+
if (cleanupResult.removed.length > 0) {
|
|
11461
|
+
console.log(`[Daemon] EP1190: Cleaned up ${cleanupResult.removed.length} non-module worktree(s): ${cleanupResult.removed.join(", ")}`);
|
|
11462
|
+
}
|
|
11463
|
+
if (cleanupResult.errors.length > 0) {
|
|
11464
|
+
for (const err of cleanupResult.errors) {
|
|
11465
|
+
console.warn(`[Daemon] EP1190: Non-module cleanup error: ${err}`);
|
|
11466
|
+
}
|
|
11467
|
+
}
|
|
11468
|
+
} catch (cleanupError) {
|
|
11469
|
+
console.warn("[Daemon] EP1190: Failed to cleanup non-module worktrees:", cleanupError.message);
|
|
11470
|
+
}
|
|
11406
11471
|
} catch (error) {
|
|
11407
11472
|
console.warn(`[Daemon] EP1035: Failed to audit ${projectPath}:`, error);
|
|
11408
11473
|
}
|