diff --git a/vibn-agent-runner/dist/server.js b/vibn-agent-runner/dist/server.js index fea5c0c6..d6ef32c2 100644 --- a/vibn-agent-runner/dist/server.js +++ b/vibn-agent-runner/dist/server.js @@ -125,6 +125,18 @@ function ensureWorkspace(repo, sessionId) { return mainRepoDir; } } + // 5. Sync active workspace edits from mainRepoDir (containing Monaco edits) to taskWorktreePath + if (taskWorktreePath !== mainRepoDir) { + try { + console.log(`[worktree] Syncing active workspace edits from ${mainRepoDir} to ${taskWorktreePath}...`); + // Use rsync to copy active files while preserving structure and deleting files deleted in mainRepoDir + // Exclude node_modules, .git, .next, .vibncode/settings.json, etc. + (0, child_process_1.execSync)(`rsync -ar --delete --exclude="node_modules" --exclude=".git" --exclude=".next" --exclude=".vibncode/settings.json" "${mainRepoDir}/" "${taskWorktreePath}/"`, { stdio: "pipe" }); + } + catch (syncErr) { + console.warn("[worktree] rsync failed, falling back to cp:", syncErr.message || syncErr); + } + } return taskWorktreePath; } function buildContext(repo, sessionId) { diff --git a/vibn-agent-runner/src/server.ts b/vibn-agent-runner/src/server.ts index 15de1870..51d564cc 100644 --- a/vibn-agent-runner/src/server.ts +++ b/vibn-agent-runner/src/server.ts @@ -113,6 +113,26 @@ function ensureWorkspace(repo?: string, sessionId?: string): string { } } + // 5. Sync active workspace edits from mainRepoDir (containing Monaco edits) to taskWorktreePath + if (taskWorktreePath !== mainRepoDir) { + try { + console.log( + `[worktree] Syncing active workspace edits from ${mainRepoDir} to ${taskWorktreePath}...`, + ); + // Use rsync to copy active files while preserving structure and deleting files deleted in mainRepoDir + // Exclude node_modules, .git, .next, .vibncode/settings.json, etc. + execSync( + `rsync -ar --delete --exclude="node_modules" --exclude=".git" --exclude=".next" --exclude=".vibncode/settings.json" "${mainRepoDir}/" "${taskWorktreePath}/"`, + { stdio: "pipe" }, + ); + } catch (syncErr: any) { + console.warn( + "[worktree] rsync failed, falling back to cp:", + syncErr.message || syncErr, + ); + } + } + return taskWorktreePath; }