MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / validateRepoDir

Function validateRepoDir

projects/electron/src/modules/code/git.ts:355–365  ·  view source on GitHub ↗

* Validate repository directory

(dir: string)

Source from the content-addressed store, hash-verified

353 * Validate repository directory
354 */
355function validateRepoDir(dir: string): void {
356 if (!dir || typeof dir !== "string") {
357 throw new Error("repoDir must be a non-empty string")
358 }
359 if (!fs.existsSync(dir)) {
360 throw new Error(`Repository directory does not exist: ${dir}`)
361 }
362 if (!fs.statSync(dir).isDirectory()) {
363 throw new Error(`Path is not a directory: ${dir}`)
364 }
365}
366
367/**
368 * Validate worktree ID (prevent path traversal)

Callers 9

handleWorkTreeDiffPatchFunction · 0.85
handleGetMergeBaseFunction · 0.85
handleListFilesFunction · 0.85
handleDeleteWorkTreeFunction · 0.85
handleListWorkTreesFunction · 0.85
handleCommitWorkTreeFunction · 0.85
handleListBranchesFunction · 0.85

Calls 1

isDirectoryMethod · 0.80

Tested by

no test coverage detected