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-repository
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 { AccountCredentialManager } from '../agent/credentials/types.js';
import type { DispatchManager, PhaseDispatchManager } from '../dispatch/types.js';
import type { CoordinationManager } from '../coordination/types.js';
@@ -80,6 +81,8 @@ export interface TRPCContext {
chatSessionRepository?: ChatSessionRepository;
/** Review comment repository for inline review comments on phase diffs */
reviewCommentRepository?: ReviewCommentRepository;
/** Errand repository for errand CRUD operations */
errandRepository?: ErrandRepository;
/** Project sync manager for remote fetch/sync operations */
projectSyncManager?: ProjectSyncManager;
/** Absolute path to the workspace root (.cwrc directory) */
@@ -113,6 +116,7 @@ export interface CreateContextOptions {
conversationRepository?: ConversationRepository;
chatSessionRepository?: ChatSessionRepository;
reviewCommentRepository?: ReviewCommentRepository;
errandRepository?: ErrandRepository;
projectSyncManager?: ProjectSyncManager;
workspaceRoot?: string;
}
@@ -148,6 +152,7 @@ export function createContext(options: CreateContextOptions): TRPCContext {
conversationRepository: options.conversationRepository,
chatSessionRepository: options.chatSessionRepository,
reviewCommentRepository: options.reviewCommentRepository,
errandRepository: options.errandRepository,
projectSyncManager: options.projectSyncManager,
workspaceRoot: options.workspaceRoot,
};