feat: Add remote sync for project clones
Fetch remote changes before agents start working so they build on up-to-date code. Adds ProjectSyncManager with git fetch + ff-only merge of defaultBranch, integrated into phase dispatch to sync before branch creation. - Schema: lastFetchedAt column on projects table (migration 0029) - Events: project:synced, project:sync_failed - Phase dispatch: sync all linked projects before creating branches - tRPC: syncProject, syncAllProjects, getProjectSyncStatus - CLI: cw project sync [name] --all, cw project status [name] - Frontend: sync button + ahead/behind badge on projects settings
This commit is contained in:
@@ -48,6 +48,7 @@ import { DefaultPhaseDispatchManager } from './dispatch/phase-manager.js';
|
||||
import type { DispatchManager, PhaseDispatchManager } from './dispatch/types.js';
|
||||
import { SimpleGitBranchManager } from './git/simple-git-branch-manager.js';
|
||||
import type { BranchManager } from './git/branch-manager.js';
|
||||
import { ProjectSyncManager } from './git/remote-sync.js';
|
||||
import { ExecutionOrchestrator } from './execution/orchestrator.js';
|
||||
import { DefaultConflictResolutionService } from './coordination/conflict-resolution-service.js';
|
||||
import { PreviewManager } from './preview/index.js';
|
||||
@@ -118,6 +119,7 @@ export interface Container extends Repositories {
|
||||
dispatchManager: DispatchManager;
|
||||
phaseDispatchManager: PhaseDispatchManager;
|
||||
branchManager: BranchManager;
|
||||
projectSyncManager: ProjectSyncManager;
|
||||
executionOrchestrator: ExecutionOrchestrator;
|
||||
previewManager: PreviewManager;
|
||||
|
||||
@@ -192,6 +194,14 @@ export async function createContainer(options?: ContainerOptions): Promise<Conta
|
||||
const branchManager = new SimpleGitBranchManager();
|
||||
log.info('branch manager created');
|
||||
|
||||
// Project sync manager
|
||||
const projectSyncManager = new ProjectSyncManager(
|
||||
repos.projectRepository,
|
||||
workspaceRoot,
|
||||
eventBus,
|
||||
);
|
||||
log.info('project sync manager created');
|
||||
|
||||
// Dispatch managers
|
||||
const dispatchManager = new DefaultDispatchManager(
|
||||
repos.taskRepository,
|
||||
@@ -212,6 +222,7 @@ export async function createContainer(options?: ContainerOptions): Promise<Conta
|
||||
repos.projectRepository,
|
||||
branchManager,
|
||||
workspaceRoot,
|
||||
projectSyncManager,
|
||||
);
|
||||
log.info('dispatch managers created');
|
||||
|
||||
@@ -258,6 +269,7 @@ export async function createContainer(options?: ContainerOptions): Promise<Conta
|
||||
dispatchManager,
|
||||
phaseDispatchManager,
|
||||
branchManager,
|
||||
projectSyncManager,
|
||||
executionOrchestrator,
|
||||
previewManager,
|
||||
...repos,
|
||||
@@ -269,6 +281,7 @@ export async function createContainer(options?: ContainerOptions): Promise<Conta
|
||||
dispatchManager,
|
||||
phaseDispatchManager,
|
||||
branchManager,
|
||||
projectSyncManager,
|
||||
executionOrchestrator,
|
||||
previewManager,
|
||||
workspaceRoot,
|
||||
|
||||
Reference in New Issue
Block a user