MCPcopy
hub / github.com/codeaashu/claude-code / ensureScratchpadDir

Function ensureScratchpadDir

src/utils/permissions/filesystem.ts:394–407  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

392 * @throws If scratchpad feature is not enabled
393 */
394export 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
410function isScratchpadPath(absolutePath: string): boolean {

Callers 1

init.tsFile · 0.85

Calls 3

isScratchpadEnabledFunction · 0.85
getFsImplementationFunction · 0.85
getScratchpadDirFunction · 0.85

Tested by

no test coverage detected