(path: string)
| 210 | * @returns Array of file names |
| 211 | */ |
| 212 | export async function listFiles(path: string): Promise<string[]> { |
| 213 | const sandbox = await createSandbox(); |
| 214 | |
| 215 | try { |
| 216 | const files = await sandbox.filesystem.list(path); |
| 217 | await logMessage("info", `Listed files in sandbox: ${path}`, { fileCount: files.length }); |
| 218 | return files; |
| 219 | } catch (error: unknown) { |
| 220 | const errorMessage = error instanceof Error ? error.message : String(error); |
| 221 | await logMessage("error", `Failed to list files in sandbox: ${path}`, { error: errorMessage }); |
| 222 | throw error; |
| 223 | } finally { |
| 224 | await sandbox.close(); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Install packages in the sandbox |
no test coverage detected