( filename: string, chatId: string, pattern: string, options?: GrepOptions )
| 171 | * message verbatim. |
| 172 | */ |
| 173 | export async function grepChatUpload( |
| 174 | filename: string, |
| 175 | chatId: string, |
| 176 | pattern: string, |
| 177 | options?: GrepOptions |
| 178 | ): Promise<GrepMatch[] | string[] | GrepCountEntry[]> { |
| 179 | const row = await findMothershipUploadRowByChatAndName(chatId, filename) |
| 180 | if (!row) { |
| 181 | throw new WorkspaceFileGrepError( |
| 182 | `Upload not found: "${filename}". Use glob("uploads/*") to list available uploads.` |
| 183 | ) |
| 184 | } |
| 185 | const record = toWorkspaceFileRecord(row) |
| 186 | const result = await readFileRecord(record) |
| 187 | if (!result) { |
| 188 | throw new WorkspaceFileGrepError(`Upload content not found for "${filename}".`) |
| 189 | } |
| 190 | const uploadsPath = `uploads/${canonicalUploadKey(record.name)}` |
| 191 | return grepReadResult(uploadsPath, result, pattern, uploadsPath, options) |
| 192 | } |
no test coverage detected