* Validate repository directory
(dir: string)
| 353 | * Validate repository directory |
| 354 | */ |
| 355 | function 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) |
no test coverage detected