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

Function buildDoctorReport

extensions/java-modernization-studio/doctor.mjs:244–412  ·  view source on GitHub ↗
({ probes, scan })

Source from the content-addressed store, hash-verified

242 * @returns {{ overall:"ready"|"caution"|"blocked", generatedAt:string, groups:Array }}
243 */
244export function buildDoctorReport({ probes, scan }) {
245 const get = (k) => (probes && probes[k]) || { found: false, version: null };
246 const a = (scan && scan.assessment) || {};
247 const buildTool = a.buildTool || null;
248
249 const buildRun = [];
250
251 // --- JDK -----------------------------------------------------------------
252 const java = get("java");
253 buildRun.push(
254 java.found
255 ? { id: "jdk", label: "Java Development Kit", status: "ok", detail: "Java " + (java.version || "detected") }
256 : {
257 id: "jdk",
258 label: "Java Development Kit",
259 status: "fail",
260 detail: "java not found on PATH",
261 fix: "Install a JDK 17 or newer (Microsoft Build of OpenJDK or Eclipse Temurin) and make sure `java` is on your PATH.",
262 action: envAction("a JDK", "java not found on PATH", "Install JDK 17+ (Microsoft OpenJDK / Temurin) and add it to PATH."),
263 }
264 );
265
266 // --- Build tool ----------------------------------------------------------
267 if (buildTool === "Maven") {
268 const mvn = get("mvn");
269 const ok = mvn.found || a.hasMavenWrapper;
270 buildRun.push(
271 ok
272 ? {
273 id: "build",
274 label: "Maven",
275 status: "ok",
276 detail: mvn.found ? "Maven " + (mvn.version || "detected") : "Using the project Maven wrapper (./mvnw)",
277 }
278 : {
279 id: "build",
280 label: "Maven",
281 status: "fail",
282 detail: "mvn not found and no ./mvnw wrapper in the repo",
283 fix: "Install Apache Maven, or add the Maven wrapper (`mvn -N wrapper:wrapper`) so the build runs anywhere.",
284 action: envAction("Maven", "mvn not found and no ./mvnw wrapper", "Install Apache Maven or add the ./mvnw wrapper."),
285 }
286 );
287 } else if (buildTool === "Gradle") {
288 const gr = get("gradle");
289 const ok = gr.found || a.hasGradleWrapper;
290 buildRun.push(
291 ok
292 ? {
293 id: "build",
294 label: "Gradle",
295 status: "ok",
296 detail: gr.found ? "Gradle " + (gr.version || "detected") : "Using the project Gradle wrapper (./gradlew)",
297 }
298 : {
299 id: "build",
300 label: "Gradle",
301 status: "fail",

Callers 2

cockpit.test.mjsFile · 0.90
runDoctorFunction · 0.85

Calls 2

getFunction · 0.85
envActionFunction · 0.85

Tested by

no test coverage detected