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

Function buildPrompt

extensions/java-modernization-studio/prompts.mjs:32–155  ·  view source on GitHub ↗
(kind, payload, repoPath)

Source from the content-addressed store, hash-verified

30 * @returns {string|null} prompt text, or null for unknown actions / unknown task ids.
31 */
32export function buildPrompt(kind, payload, repoPath) {
33 const p = payload || {};
34 switch (kind) {
35 case "start_assessment":
36 return (
37 APPMOD_PREAMBLE +
38 "\n\nRun an App Modernization assessment of this Java project at " + repoPath + ". " +
39 "Report the current Java runtime, build tool, framework versions, outdated/vulnerable dependencies, " +
40 "and cloud-readiness issues for Azure. Summarize findings and write a prioritized plan.md of remediation steps. Do not change code yet." +
41 "\n\nAlso write the findings as structured JSON to .appmod/assessment.json so the cockpit can render them. Use this shape:\n" +
42 "{\n" +
43 ' "generatedAt": "<ISO 8601 timestamp>",\n' +
44 ' "headline": "<one-line stack summary>",\n' +
45 ' "summary": "<2-3 sentence plain-language verdict>",\n' +
46 ' "stack": { "buildTool": "", "java": "", "framework": "", "database": "", "container": "" },\n' +
47 ' "findings": [\n' +
48 ' { "id": "kebab-id", "severity": "P0|P1|P2|P3", "title": "", "detail": "", "files": ["path"],\n' +
49 ' "action": { "kind": "run_task|generate_plan|run_cve|generate_tests|fix_finding", "payload": {}, "label": "" } }\n' +
50 " ],\n" +
51 ' "strengths": ["<things already done well>"]\n' +
52 "}\n" +
53 "Order findings by severity (P0 first). For action.kind, use run_task with payload {\"taskId\":\"...\"} when a Microsoft predefined task fits, " +
54 "generate_plan/run_cve/generate_tests when those fit, otherwise use fix_finding (the cockpit turns it into a 'Help me fix this' button). Omit action only if there is genuinely nothing to do."
55 );
56 case "generate_plan":
57 return (
58 APPMOD_PREAMBLE +
59 "\n\nCreate a step-by-step modernization plan to upgrade this project to Java " + (p.targetJava || 21) + ". " +
60 "Cover build-file changes, removed/replaced APIs, dependency upgrades, and required test updates. " +
61 "Write the plan as a checklist in plan.md and create an empty progress.md mirroring those steps. Do not change code yet."
62 );
63 case "run_task": {
64 const t = PREDEFINED_TASKS.find((x) => x.id === p.taskId);
65 if (!t) return null;
66 return (
67 APPMOD_PREAMBLE +
68 "\n\nApply the App Modernization predefined task \"" + t.name + "\": " + t.summary + "\n" +
69 "Steps: (1) record the plan in plan.md and progress.md; (2) check out a migration branch; " +
70 "(3) make the code changes for this task; (4) validate by building, running unit tests, and a CVE check; " +
71 "(5) write a summary.md of what changed. Pause for my confirmation before committing."
72 );
73 }
74 case "run_skill":
75 if (!p.folder) return null;
76 return (
77 APPMOD_PREAMBLE +
78 "\n\nRun the custom modernization skill in .github/skills/" + p.folder + "/SKILL.md. " +
79 "Follow its instructions and referenced resources exactly, updating plan.md and progress.md as you go, " +
80 "and write summary.md when finished."
81 );
82 case "run_cve":
83 return "Check this Java project for known CVE issues using #appmod-validate-cves-for-java and report which dependencies need upgrading, then update progress.md.";
84 case "generate_tests":
85 return "Generate unit tests for this Java project using #appmod-generate-tests-for-java, then run them and record the result in progress.md.";
86 case "run_build_tests":
87 return "Build this project and run its unit tests. Report failures with root-cause analysis and update the Build and Unit Tests entries in progress.md.";
88 case "run_consistency":
89 return "Run a consistency check comparing the modernized code against the original behavior (APIs, SQL, wire format). List any behavioral differences and update progress.md.";

Callers 3

startAutopilotFunction · 0.90
dispatchActionFunction · 0.90
cockpit.test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected