MCPcopy
hub / github.com/github/awesome-copilot / heroNext

Function heroNext

extensions/java-modernization-studio/renderer.mjs:389–445  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

387 }
388
389 function heroNext(s) {
390 const rep = s.report;
391 const findings = rep && rep.findings ? rep.findings : [];
392 const hasReport = findings.length > 0;
393 const p0 = findings.filter((f) => f.severity === "P0");
394 const p1 = findings.filter((f) => f.severity === "P1");
395 const gates = s.gates || {};
396 const anyGate = Object.keys(gates).some((k) => gates[k] && gates[k] !== "not_run");
397 const hasPlan = !!((s.plan && s.plan.exists) || (s.progress && s.progress.exists));
398
399 if (s.status === "completed") {
400 return {
401 eyebrow: "Final step",
402 title: "Ship your changes",
403 body: "Validations are complete. Open a pull request to hand off the modernized service.",
404 actions: btn("Open a pull request", "open_pr", {}, { primary: true }) + btn("View summary", "goto:summary"),
405 };
406 }
407 if (!hasReport && !hasPlan) {
408 return {
409 eyebrow: "Start here",
410 title: "Assess the project",
411 body: "Scan the repo for its Java runtime, dependencies, known CVEs, and Azure cloud-readiness gaps. Nothing changes in your code — you get a prioritized list of findings to work through.",
412 actions: btn("Run assessment", "start_assessment", {}, { primary: true }),
413 };
414 }
415 if (p0.length) {
416 return {
417 eyebrow: "Blocker — fix this first",
418 title: p0[0].title,
419 body: esc(p0[0].detail || "A P0 issue is blocking modernization. Resolve it before moving on."),
420 actions: heroAction(p0[0]) + btn("See all findings", "goto:assessment"),
421 };
422 }
423 if (hasReport && !anyGate) {
424 if (p1.length) {
425 return {
426 eyebrow: "Recommended next",
427 title: "Start remediation: " + p1[0].title,
428 body: esc(p1[0].detail || "Work through the high-priority findings first."),
429 actions: heroAction(p1[0]) + btn("See all findings", "goto:assessment"),
430 };
431 }
432 return {
433 eyebrow: "Recommended next",
434 title: "Work through the findings",
435 body: "Open the Assessment tab and resolve findings by priority. Each one has a button that hands the fix to the agent.",
436 actions: btn("Open Assessment", "goto:assessment", {}, { primary: true }),
437 };
438 }
439 return {
440 eyebrow: "Recommended next",
441 title: "Validate your changes",
442 body: "Build the project, run unit tests, and re-check CVEs to confirm the migration holds.",
443 actions: btn("Build & run tests", "run_build_tests", {}, { primary: true }) + btn("Open Validation", "goto:validation"),
444 };
445 }
446

Callers 1

overviewTabFunction · 0.85

Calls 3

btnFunction · 0.85
escFunction · 0.85
heroActionFunction · 0.85

Tested by

no test coverage detected