MCPcopy Index your code
hub / github.com/github/awesome-copilot / runDoctor

Function runDoctor

extensions/java-modernization-studio/doctor.mjs:216–234  ·  view source on GitHub ↗
(scan, opts = {})

Source from the content-addressed store, hash-verified

214
215/** Probe every tool and build the readiness report. Impure (spawns processes). */
216export 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
236function envAction(tool, detail, fix) {
237 return { kind: "fix_env", payload: { tool, detail, fix }, label: "Help me set up " + tool };

Callers 2

createInstanceServerFunction · 0.90
cockpit.test.mjsFile · 0.90

Calls 5

augmentedEnvFunction · 0.85
discoverJavaHomeFunction · 0.85
makeExecFunction · 0.85
probeOneFunction · 0.85
buildDoctorReportFunction · 0.85

Tested by

no test coverage detected