(scan, opts = {})
| 214 | |
| 215 | /** Probe every tool and build the readiness report. Impure (spawns processes). */ |
| 216 | export async function runDoctor(scan, opts = {}) { |
| 217 | let exec = opts.exec; |
| 218 | if (!exec) { |
| 219 | const env = augmentedEnv(process.env, platform()); |
| 220 | // Prefer the JDK the user's shell is configured with so the report matches |
| 221 | // their terminal (and so a dependency-pulled JDK doesn't shadow their pin). |
| 222 | // Static rc parse — no shell sourcing. |
| 223 | const jh = await discoverJavaHome(process.env, platform()); |
| 224 | if (jh && !env.JAVA_HOME) { |
| 225 | env.JAVA_HOME = jh; |
| 226 | env.PATH = jh + "/bin:" + env.PATH; |
| 227 | } |
| 228 | exec = makeExec(env); |
| 229 | } |
| 230 | const probesArr = await Promise.all(TOOL_PROBES.map((d) => probeOne(d, exec))); |
| 231 | const probes = {}; |
| 232 | for (const p of probesArr) probes[p.key] = p; |
| 233 | return buildDoctorReport({ probes, scan: scan || {} }); |
| 234 | } |
| 235 | |
| 236 | function envAction(tool, detail, fix) { |
| 237 | return { kind: "fix_env", payload: { tool, detail, fix }, label: "Help me set up " + tool }; |
no test coverage detected