Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fix lint issues
  • Loading branch information
sinedied committed Jul 16, 2025
commit 160c54414bad00c076e88bb1fa8b91c503aa4773
2 changes: 2 additions & 0 deletions packages/angular/cli/src/commands/mcp/recommendations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
// Note: this file is copied from:
// https://github.com/angular/angular/blob/main/adev/src/app/features/update/recommendations.ts
// A better sync mechanism should be implemented in the future
// Disabling the max-len rule as it seems the eslint format is different in the Angular repo.
/* eslint-disable max-len */

export enum ApplicationComplexity {
Basic = 1,
Expand Down
118 changes: 76 additions & 42 deletions packages/angular/cli/src/commands/mcp/tools/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,48 +232,15 @@ export async function registerUpdateTool(server: McpServer): Promise<void> {
}
}

// Generate markdown output
let markdown = `# Angular Update Guide: v${fromVersion} → v${toVersion}\n\n`;
markdown += `**Application complexity:** ${complexity}\n`;
markdown += `**Options:** ${
Object.entries(options)
.filter(([_, value]) => value)
.map(([key]) => key)
.join(', ') || 'none'
}\n\n`;

if (beforeSteps.length > 0) {
markdown += `## Before Updating (Optional preparations)\n\n`;
markdown += `These steps can be performed before the update to prepare your application:\n\n`;
beforeSteps.forEach((step, index) => {
markdown += `### ${index + 1}. ${step.step}\n\n`;
markdown += `${step.action}\n\n`;
});
}

if (duringSteps.length > 0) {
markdown += `## During Update (Required)\n\n`;
markdown += `These steps must be performed as part of the update process:\n\n`;
duringSteps.forEach((step, index) => {
markdown += `### ${index + 1}. ${step.step}\n\n`;
markdown += `${step.action}\n\n`;
});
}

if (afterSteps.length > 0) {
markdown += `## After Update (Follow-up)\n\n`;
markdown += `These steps should be performed after the main update:\n\n`;
afterSteps.forEach((step, index) => {
markdown += `### ${index + 1}. ${step.step}\n\n`;
markdown += `${step.action}\n\n`;
});
}

if (beforeSteps.length === 0 && duringSteps.length === 0 && afterSteps.length === 0) {
markdown += `## No Specific Steps Required\n\n`;
markdown += `Based on your configuration, no specific migration steps are required for updating from v${fromVersion} to v${toVersion}. `;
markdown += `You can proceed with the standard Angular update process using \`ng update\`.\n\n`;
}
const markdown = generateUpdateGuideMarkdown(
fromVersion,
toVersion,
complexity,
options,
beforeSteps,
duringSteps,
afterSteps,
);

return {
content: [
Expand All @@ -286,3 +253,70 @@ export async function registerUpdateTool(server: McpServer): Promise<void> {
},
);
}

/**
* Generates markdown output for the Angular update guide.
*
* @param fromVersion The source Angular version
* @param toVersion The target Angular version
* @param complexity The application complexity level
* @param options The selected options (ngUpgrade, material)
* @param beforeSteps Steps to perform before updating
* @param duringSteps Steps to perform during the update
* @param afterSteps Steps to perform after the update
* @returns The generated markdown string
*/
function generateUpdateGuideMarkdown(
fromVersion: string,
toVersion: string,
complexity: string,
options: { ngUpgrade: boolean; material: boolean },
beforeSteps: Step[],
duringSteps: Step[],
afterSteps: Step[],
): string {
let markdown = `# Angular Update Guide: v${fromVersion} → v${toVersion}\n\n`;
markdown += `**Application complexity:** ${complexity}\n`;
markdown += `**Options:** ${
Object.entries(options)
.filter(([_, value]) => value)
.map(([key]) => key)
.join(', ') || 'none'
}\n\n`;

if (beforeSteps.length > 0) {
markdown += `## Before Updating (Optional preparations)\n\n`;
markdown += `These steps can be performed before the update to prepare your application:\n\n`;
beforeSteps.forEach((step, index) => {
markdown += `### ${index + 1}. ${step.step}\n\n`;
markdown += `${step.action}\n\n`;
});
}

if (duringSteps.length > 0) {
markdown += `## During Update (Required)\n\n`;
markdown += `These steps must be performed as part of the update process:\n\n`;
duringSteps.forEach((step, index) => {
markdown += `### ${index + 1}. ${step.step}\n\n`;
markdown += `${step.action}\n\n`;
});
}

if (afterSteps.length > 0) {
markdown += `## After Update (Follow-up)\n\n`;
markdown += `These steps should be performed after the main update:\n\n`;
afterSteps.forEach((step, index) => {
markdown += `### ${index + 1}. ${step.step}\n\n`;
markdown += `${step.action}\n\n`;
});
}

if (beforeSteps.length === 0 && duringSteps.length === 0 && afterSteps.length === 0) {
markdown += `## No Specific Steps Required\n\n`;
markdown += `Based on your configuration, no specific migration steps are required for updating `;
markdown += `from v${fromVersion} to v${toVersion}. `;
markdown += `You can proceed with the standard Angular update process using \`ng update\`.\n\n`;
}

return markdown;
}