feat: Add errands schema, repository, and wire into tRPC context/container

Creates the errands table (with conflictFiles column), errand-repository
port interface, DrizzleErrandRepository adapter, and wires the repository
into TRPCContext, the DI container, _helpers.ts requireErrandRepository guard,
and the test harness. Also fixes pre-existing TS error in controller.test.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas May
2026-03-06 15:49:26 +01:00
parent 67658fb717
commit 3a328d2b1c
13 changed files with 2226 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ import type { LogChunkRepository } from '../../db/repositories/log-chunk-reposit
import type { ConversationRepository } from '../../db/repositories/conversation-repository.js';
import type { ChatSessionRepository } from '../../db/repositories/chat-session-repository.js';
import type { ReviewCommentRepository } from '../../db/repositories/review-comment-repository.js';
import type { ErrandRepository } from '../../db/repositories/errand-repository.js';
import type { DispatchManager, PhaseDispatchManager } from '../../dispatch/types.js';
import type { CoordinationManager } from '../../coordination/types.js';
import type { BranchManager } from '../../git/branch-manager.js';
@@ -225,3 +226,13 @@ export function requireProjectSyncManager(ctx: TRPCContext): ProjectSyncManager
}
return ctx.projectSyncManager;
}
export function requireErrandRepository(ctx: TRPCContext): ErrandRepository {
if (!ctx.errandRepository) {
throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
message: 'Errand repository not available',
});
}
return ctx.errandRepository;
}