(resolved: string)
| 136 | * With no directory roots and no CLI files, nothing is writable. |
| 137 | */ |
| 138 | export function isWritablePath(resolved: string): boolean { |
| 139 | if (cliLocalFiles.has(resolved)) return true; |
| 140 | // MCP file root → always read-only, regardless of ancestry |
| 141 | if (allowedLocalFiles.has(resolved)) return false; |
| 142 | return [...allowedLocalDirs].some((dir) => { |
| 143 | if (!isAncestorDir(dir, resolved)) return false; |
| 144 | if (!writeFlags.allowUploadsRoot && path.basename(dir) === "uploads") { |
| 145 | return false; |
| 146 | } |
| 147 | return true; |
| 148 | }); |
| 149 | } |
| 150 | |
| 151 | // Works both from source (server.ts) and compiled (dist/server.js) |
| 152 | const DIST_DIR = import.meta.filename.endsWith(".ts") |
no test coverage detected
searching dependent graphs…