( worktreePath: string, )
| 96 | * @throws PathValidationError if chat is not registered |
| 97 | */ |
| 98 | export function getRegisteredChat( |
| 99 | worktreePath: string, |
| 100 | ): typeof chats.$inferSelect { |
| 101 | const db = getDatabase(); |
| 102 | const chat = db |
| 103 | .select() |
| 104 | .from(chats) |
| 105 | .where(eq(chats.worktreePath, worktreePath)) |
| 106 | .get(); |
| 107 | |
| 108 | if (!chat) { |
| 109 | throw new PathValidationError( |
| 110 | "Chat not registered in database", |
| 111 | "UNREGISTERED_WORKTREE", |
| 112 | ); |
| 113 | } |
| 114 | |
| 115 | return chat; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Options for path validation. |
no test coverage detected