()
| 392 | * @throws If scratchpad feature is not enabled |
| 393 | */ |
| 394 | export async function ensureScratchpadDir(): Promise<string> { |
| 395 | if (!isScratchpadEnabled()) { |
| 396 | throw new Error('Scratchpad directory feature is not enabled') |
| 397 | } |
| 398 | |
| 399 | const fs = getFsImplementation() |
| 400 | const scratchpadDir = getScratchpadDir() |
| 401 | |
| 402 | // Create directory recursively with secure permissions (owner-only access) |
| 403 | // FsOperations.mkdir handles recursive: true internally and is a no-op if dir exists |
| 404 | await fs.mkdir(scratchpadDir, { mode: 0o700 }) |
| 405 | |
| 406 | return scratchpadDir |
| 407 | } |
| 408 | |
| 409 | // Check if file is within the scratchpad directory |
| 410 | function isScratchpadPath(absolutePath: string): boolean { |
no test coverage detected