fix: register errand router in appRouter and fix build errors

errandProcedures was defined but never imported/spread into the app
router, causing "No procedure found on path errand.create". Also fixed
nullable projectId TS errors in delete/abandon and added missing
sendUserMessage to test mocks.
This commit is contained in:
Lukas May
2026-03-06 21:17:44 +01:00
parent f5b1a3a5b9
commit 388befd7c3
5 changed files with 21 additions and 13 deletions

View File

@@ -1878,7 +1878,7 @@ See the Codewalkers documentation for .cw-preview.yml format and options.`;
: `.cw-worktrees/${id}`;
console.log(`Resolve conflicts in worktree: ${worktreePath}`);
console.log('Conflicting files:');
for (const f of errand.conflictFiles ?? []) {
for (const f of (errand as any).conflictFiles ?? []) {
console.log(` ${f}`);
}
console.log('After resolving: stage and commit changes in the worktree, then run:');

View File

@@ -63,6 +63,7 @@ class MockAgentManager implements AgentManager {
async delete(): Promise<void> { throw new Error('Not implemented'); }
async dismiss(): Promise<void> { throw new Error('Not implemented'); }
async resumeForConversation(): Promise<boolean> { return false; }
async sendUserMessage(): Promise<void> { throw new Error('Not implemented'); }
}
// =============================================================================

View File

@@ -69,6 +69,7 @@ class MockAgentManager implements AgentManager {
async delete(): Promise<void> { throw new Error('Not implemented'); }
async dismiss(): Promise<void> { throw new Error('Not implemented'); }
async resumeForConversation(): Promise<boolean> { return false; }
async sendUserMessage(): Promise<void> { throw new Error('Not implemented'); }
}
// =============================================================================

View File

@@ -25,6 +25,7 @@ import { previewProcedures } from './routers/preview.js';
import { conversationProcedures } from './routers/conversation.js';
import { chatSessionProcedures } from './routers/chat-session.js';
import { headquartersProcedures } from './routers/headquarters.js';
import { errandProcedures } from './routers/errand.js';
// Re-export tRPC primitives (preserves existing import paths)
export { router, publicProcedure, middleware, createCallerFactory } from './trpc.js';
@@ -65,6 +66,7 @@ export const appRouter = router({
...conversationProcedures(publicProcedure),
...chatSessionProcedures(publicProcedure),
...headquartersProcedures(publicProcedure),
...errandProcedures(publicProcedure),
});
export type AppRouter = typeof appRouter;

View File

@@ -350,6 +350,7 @@ export function errandProcedures(publicProcedure: ProcedureBuilder) {
}
// Remove worktree and branch (best-effort)
if (errand.projectId) {
const project = await requireProjectRepository(ctx).findById(errand.projectId);
if (project) {
const clonePath = await resolveClonePath(project, ctx);
@@ -357,6 +358,7 @@ export function errandProcedures(publicProcedure: ProcedureBuilder) {
try { await worktreeManager.remove(errand.id); } catch { /* no-op if already gone */ }
try { await requireBranchManager(ctx).deleteBranch(clonePath, errand.branch); } catch { /* no-op */ }
}
}
await repo.delete(errand.id);
return { success: true };
@@ -426,6 +428,7 @@ export function errandProcedures(publicProcedure: ProcedureBuilder) {
}
// Remove worktree and branch (best-effort)
if (errand.projectId) {
const project = await requireProjectRepository(ctx).findById(errand.projectId);
if (project) {
const clonePath = await resolveClonePath(project, ctx);
@@ -433,6 +436,7 @@ export function errandProcedures(publicProcedure: ProcedureBuilder) {
try { await worktreeManager.remove(errand.id); } catch { /* no-op if already gone */ }
try { await branchManager.deleteBranch(clonePath, errand.branch); } catch { /* no-op */ }
}
}
const updated = await repo.update(input.id, { status: 'abandoned' });
return updated;