(
searchFrom: string,
opts: { subprojectScan?: boolean } = {},
)
| 501 | * a tool call would refuse them. |
| 502 | */ |
| 503 | export function resolveServerRoot( |
| 504 | searchFrom: string, |
| 505 | opts: { subprojectScan?: boolean } = {}, |
| 506 | ): ServerRootResolution { |
| 507 | const found = findServerRoot(searchFrom, opts); |
| 508 | if (!found.root && found.candidates.length === 0) return found; |
| 509 | const startRefusal = fs.existsSync(searchFrom) ? sensitiveDirectoryRefusal(searchFrom) : null; |
| 510 | if (!found.root) return startRefusal ? { ...found, candidates: [] } : found; |
| 511 | const refusal = startRefusal ?? sensitiveDirectoryRefusal(found.root); |
| 512 | return refusal ? { root: null, viaSubScan: false, candidates: [], refusal } : found; |
| 513 | } |
| 514 | |
| 515 | /** {@link resolveServerRoot} before the sensitive-folder refusal. */ |
| 516 | function findServerRoot(searchFrom: string, opts: { subprojectScan?: boolean }): ServerRootResolution { |
no test coverage detected