( workPath: string )
| 39 | } |
| 40 | |
| 41 | export async function getServicesSetupState( |
| 42 | workPath: string |
| 43 | ): Promise<ServicesSetupState> { |
| 44 | const detectServicesResult = await detectServices({ |
| 45 | fs: new LocalFileSystemDetector(workPath), |
| 46 | detectEntrypoint: createDetectEntrypoint(workPath), |
| 47 | }); |
| 48 | // `resolved` is undefined when no services are detected at all (common for |
| 49 | // empty or simple fixtures). Defensive optional chain avoids crashing the |
| 50 | // setup flow before any prompts can fire. |
| 51 | const hasConfiguredServices = |
| 52 | detectServicesResult.resolved?.source === 'configured'; |
| 53 | const inferredServices = hasConfiguredServices |
| 54 | ? null |
| 55 | : detectServicesResult.inferred; |
| 56 | const inferredServicesWriteBlocker = inferredServices |
| 57 | ? await getServicesConfigWriteBlocker(workPath, inferredServices.config) |
| 58 | : null; |
| 59 | |
| 60 | return { |
| 61 | detectServicesResult, |
| 62 | hasConfiguredServices, |
| 63 | inferredServices, |
| 64 | inferredServicesWriteBlocker, |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | export function displayConfiguredServicesSetup( |
| 69 | detectServicesResult: DetectServicesResult, |
no test coverage detected