@redhat-cloud-services/hcc-feo-mcp 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +104 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +55 -0
- package/dist/lib/tools/getFEOBestPractices.d.ts +3 -0
- package/dist/lib/tools/getFEOBestPractices.d.ts.map +1 -0
- package/dist/lib/tools/getFEOBestPractices.js +44 -0
- package/dist/lib/tools/getFEOExamples.d.ts +3 -0
- package/dist/lib/tools/getFEOExamples.d.ts.map +1 -0
- package/dist/lib/tools/getFEOExamples.js +54 -0
- package/dist/lib/tools/getFEOFieldRecommendations.d.ts +3 -0
- package/dist/lib/tools/getFEOFieldRecommendations.d.ts.map +1 -0
- package/dist/lib/tools/getFEOFieldRecommendations.js +85 -0
- package/dist/lib/tools/getFEOMigrationTemplate.d.ts +3 -0
- package/dist/lib/tools/getFEOMigrationTemplate.d.ts.map +1 -0
- package/dist/lib/tools/getFEOMigrationTemplate.js +134 -0
- package/dist/lib/tools/getFEONavigationPositioning.d.ts +3 -0
- package/dist/lib/tools/getFEONavigationPositioning.d.ts.map +1 -0
- package/dist/lib/tools/getFEONavigationPositioning.js +43 -0
- package/dist/lib/tools/getFEOSchema.d.ts +3 -0
- package/dist/lib/tools/getFEOSchema.d.ts.map +1 -0
- package/dist/lib/tools/getFEOSchema.js +54 -0
- package/dist/lib/tools/getFEOServiceTilesSections.d.ts +3 -0
- package/dist/lib/tools/getFEOServiceTilesSections.d.ts.map +1 -0
- package/dist/lib/tools/getFEOServiceTilesSections.js +37 -0
- package/dist/lib/tools/getFEOYamlSetupTemplate.d.ts +3 -0
- package/dist/lib/tools/getFEOYamlSetupTemplate.d.ts.map +1 -0
- package/dist/lib/tools/getFEOYamlSetupTemplate.js +117 -0
- package/dist/lib/tools/validateFEOConfig.d.ts +3 -0
- package/dist/lib/tools/validateFEOConfig.d.ts.map +1 -0
- package/dist/lib/tools/validateFEOConfig.js +100 -0
- package/dist/lib/types.d.ts +6 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/utils/contentProviders.d.ts +7 -0
- package/dist/lib/utils/contentProviders.d.ts.map +1 -0
- package/dist/lib/utils/contentProviders.js +157 -0
- package/dist/lib/utils/recommendations.d.ts +8 -0
- package/dist/lib/utils/recommendations.d.ts.map +1 -0
- package/dist/lib/utils/recommendations.js +46 -0
- package/dist/lib/utils/schemaCache.d.ts +9 -0
- package/dist/lib/utils/schemaCache.d.ts.map +1 -0
- package/dist/lib/utils/schemaCache.js +30 -0
- package/dist/lib/utils/schemaHelpers.d.ts +4 -0
- package/dist/lib/utils/schemaHelpers.d.ts.map +1 -0
- package/dist/lib/utils/schemaHelpers.js +65 -0
- package/dist/lib/utils/templateGenerators.d.ts +5 -0
- package/dist/lib/utils/templateGenerators.d.ts.map +1 -0
- package/dist/lib/utils/templateGenerators.js +244 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFEOMigrationTemplateTool = getFEOMigrationTemplateTool;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const schemaCache_js_1 = require("../utils/schemaCache.js");
|
|
6
|
+
const templateGenerators_js_1 = require("../utils/templateGenerators.js");
|
|
7
|
+
const recommendations_js_1 = require("../utils/recommendations.js");
|
|
8
|
+
const contentProviders_js_1 = require("../utils/contentProviders.js");
|
|
9
|
+
function getFEOMigrationTemplateTool() {
|
|
10
|
+
async function tool(args) {
|
|
11
|
+
try {
|
|
12
|
+
const { appName, bundle, migrationType, displayTitle } = args;
|
|
13
|
+
if (!appName || !bundle || !migrationType) {
|
|
14
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, 'Missing required parameters: appName, bundle, and migrationType are required');
|
|
15
|
+
}
|
|
16
|
+
const title = displayTitle || appName.split('-').map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
17
|
+
// Ensure schema is loaded for smart generation
|
|
18
|
+
await (0, schemaCache_js_1.ensureSchemaLoaded)();
|
|
19
|
+
let template = '';
|
|
20
|
+
switch (migrationType) {
|
|
21
|
+
case 'module':
|
|
22
|
+
template = (0, templateGenerators_js_1.generateSmartTemplate)('module', {
|
|
23
|
+
appName, bundle, title,
|
|
24
|
+
manifestLocation: `/apps/${appName}/fed-mods.json`,
|
|
25
|
+
documentTitle: `${title} | Red Hat Hybrid Cloud Console`,
|
|
26
|
+
routes: [{ pathname: `/${bundle}/${appName}`, props: { bundle } }]
|
|
27
|
+
});
|
|
28
|
+
break;
|
|
29
|
+
case 'navigation':
|
|
30
|
+
template = (0, templateGenerators_js_1.generateSmartTemplate)('navigation', {
|
|
31
|
+
appName, bundle, title,
|
|
32
|
+
position: (0, recommendations_js_1.getRecommendedPosition)(bundle),
|
|
33
|
+
productName: (0, recommendations_js_1.getProductName)(bundle)
|
|
34
|
+
});
|
|
35
|
+
break;
|
|
36
|
+
case 'service-tiles':
|
|
37
|
+
const serviceSection = (0, recommendations_js_1.getRecommendedServiceSection)(bundle);
|
|
38
|
+
template = (0, templateGenerators_js_1.generateSmartTemplate)('serviceTiles', {
|
|
39
|
+
appName, bundle, title,
|
|
40
|
+
section: serviceSection.section,
|
|
41
|
+
group: serviceSection.group,
|
|
42
|
+
icon: (0, recommendations_js_1.getRecommendedIcon)(bundle)
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
case 'search':
|
|
46
|
+
template = (0, templateGenerators_js_1.generateSmartTemplate)('searchEntries', {
|
|
47
|
+
appName, bundle, title
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
case 'full':
|
|
51
|
+
const fullServiceSection = (0, recommendations_js_1.getRecommendedServiceSection)(bundle);
|
|
52
|
+
template = (0, templateGenerators_js_1.generateSmartTemplate)('full', {
|
|
53
|
+
appName, bundle, title,
|
|
54
|
+
position: (0, recommendations_js_1.getRecommendedPosition)(bundle),
|
|
55
|
+
section: fullServiceSection.section,
|
|
56
|
+
group: fullServiceSection.group,
|
|
57
|
+
icon: (0, recommendations_js_1.getRecommendedIcon)(bundle),
|
|
58
|
+
productName: (0, recommendations_js_1.getProductName)(bundle),
|
|
59
|
+
manifestLocation: `/apps/${appName}/fed-mods.json`,
|
|
60
|
+
documentTitle: `${title} | Red Hat Hybrid Cloud Console`,
|
|
61
|
+
routes: [{ pathname: `/${bundle}/${appName}`, props: { bundle } }]
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `Unknown migration type: ${migrationType}. Valid types are: module, navigation, service-tiles, search, full`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{
|
|
70
|
+
type: 'text',
|
|
71
|
+
text: `# FEO Migration Template: ${migrationType}
|
|
72
|
+
|
|
73
|
+
App: **${appName}** → **${title}**
|
|
74
|
+
Bundle: **${bundle}**
|
|
75
|
+
|
|
76
|
+
## Configuration to Add/Update
|
|
77
|
+
|
|
78
|
+
\`\`\`yaml
|
|
79
|
+
${template}
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
## Migration Steps
|
|
83
|
+
|
|
84
|
+
${(0, contentProviders_js_1.getMigrationSteps)(migrationType)}
|
|
85
|
+
|
|
86
|
+
## Validation
|
|
87
|
+
|
|
88
|
+
After applying this configuration:
|
|
89
|
+
1. Run \`npm run build\` to validate
|
|
90
|
+
2. Check for schema validation errors
|
|
91
|
+
3. Test in development environment
|
|
92
|
+
4. Mark corresponding items for replacement in chrome-service-backend`,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (error instanceof types_js_1.McpError) {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Error generating migration template: ${error instanceof Error ? error.message : String(error)}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return [
|
|
105
|
+
'getFEOMigrationTemplate',
|
|
106
|
+
{
|
|
107
|
+
description: 'Generate customized migration template for converting existing app to FEO',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
appName: {
|
|
112
|
+
type: 'string',
|
|
113
|
+
description: 'Application name in kebab-case (e.g., "learning-resources")',
|
|
114
|
+
},
|
|
115
|
+
bundle: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'Target bundle (insights, openshift, ansible, settings, etc.)',
|
|
118
|
+
},
|
|
119
|
+
migrationType: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
enum: ['navigation', 'service-tiles', 'search', 'module', 'full'],
|
|
122
|
+
description: 'Type of migration to generate template for',
|
|
123
|
+
},
|
|
124
|
+
displayTitle: {
|
|
125
|
+
type: 'string',
|
|
126
|
+
description: 'Human-readable application title (optional)',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
required: ['appName', 'bundle', 'migrationType'],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
tool
|
|
133
|
+
];
|
|
134
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFEONavigationPositioning.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/getFEONavigationPositioning.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,wBAAgB,+BAA+B,IAAI,OAAO,CAyCzD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFEONavigationPositioningTool = getFEONavigationPositioningTool;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const contentProviders_js_1 = require("../utils/contentProviders.js");
|
|
6
|
+
function getFEONavigationPositioningTool() {
|
|
7
|
+
async function tool(args) {
|
|
8
|
+
try {
|
|
9
|
+
const bundle = args?.bundle;
|
|
10
|
+
const guidance = (0, contentProviders_js_1.getNavigationPositioningGuidance)(bundle);
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: 'text',
|
|
15
|
+
text: `# Navigation Positioning Guidance${bundle ? ` for ${bundle}` : ''}
|
|
16
|
+
|
|
17
|
+
${guidance}`,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Error getting navigation positioning: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return [
|
|
27
|
+
'getFEONavigationPositioning',
|
|
28
|
+
{
|
|
29
|
+
description: 'Get guidance on navigation positioning and bundle segment organization',
|
|
30
|
+
inputSchema: {
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
bundle: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'Bundle to get positioning guidance for (optional)',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
tool
|
|
42
|
+
];
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFEOSchema.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/getFEOSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,wBAAgB,gBAAgB,IAAI,OAAO,CAqD1C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFEOSchemaTool = getFEOSchemaTool;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const schemaCache_js_1 = require("../utils/schemaCache.js");
|
|
6
|
+
function getFEOSchemaTool() {
|
|
7
|
+
async function tool(args) {
|
|
8
|
+
try {
|
|
9
|
+
const now = Date.now();
|
|
10
|
+
await (0, schemaCache_js_1.ensureSchemaLoaded)();
|
|
11
|
+
const schema = schemaCache_js_1.schemaCache.schema;
|
|
12
|
+
const cacheAge = Math.floor((now - schemaCache_js_1.schemaCache.timestamp) / 1000 / 60); // minutes
|
|
13
|
+
return {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: 'text',
|
|
17
|
+
text: `# Frontend Operator CRD Schema
|
|
18
|
+
|
|
19
|
+
Latest schema from: ${schemaCache_js_1.FEO_SCHEMA_URL}
|
|
20
|
+
Cache age: ${cacheAge} minutes (refreshes hourly)
|
|
21
|
+
|
|
22
|
+
## Schema Structure
|
|
23
|
+
- **Version**: ${schema.$schema || 'JSON Schema Draft 2020-12'}
|
|
24
|
+
- **Title**: ${schema.title}
|
|
25
|
+
- **Root Type**: ${schema.type}
|
|
26
|
+
|
|
27
|
+
## Key Definitions
|
|
28
|
+
${Object.keys(schema.$defs || {}).map((key) => `- **${key}**: ${schema.$defs[key].description || 'No description'}`).join('\n')}
|
|
29
|
+
|
|
30
|
+
## Full Schema
|
|
31
|
+
\`\`\`json
|
|
32
|
+
${JSON.stringify(schema, null, 2)}
|
|
33
|
+
\`\`\``,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Error fetching FEO schema: ${error instanceof Error ? error.message : String(error)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
'getFEOSchema',
|
|
44
|
+
{
|
|
45
|
+
description: 'Get the latest Frontend Operator CRD schema for validation and reference',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {},
|
|
49
|
+
additionalProperties: false,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
tool
|
|
53
|
+
];
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFEOServiceTilesSections.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/getFEOServiceTilesSections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,wBAAgB,8BAA8B,IAAI,OAAO,CAmCxD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFEOServiceTilesSectionsTool = getFEOServiceTilesSectionsTool;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const contentProviders_js_1 = require("../utils/contentProviders.js");
|
|
6
|
+
function getFEOServiceTilesSectionsTool() {
|
|
7
|
+
async function tool(args) {
|
|
8
|
+
try {
|
|
9
|
+
const sections = (0, contentProviders_js_1.getServiceTilesSections)();
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: 'text',
|
|
14
|
+
text: `# Service Tiles Sections and Groups
|
|
15
|
+
|
|
16
|
+
${sections}`,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Error getting service tiles sections: ${error instanceof Error ? error.message : String(error)}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return [
|
|
26
|
+
'getFEOServiceTilesSections',
|
|
27
|
+
{
|
|
28
|
+
description: 'Get available service tiles sections and groups',
|
|
29
|
+
inputSchema: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {},
|
|
32
|
+
additionalProperties: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
tool
|
|
36
|
+
];
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getFEOYamlSetupTemplate.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/getFEOYamlSetupTemplate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,wBAAgB,2BAA2B,IAAI,OAAO,CAgIrD"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFEOYamlSetupTemplateTool = getFEOYamlSetupTemplateTool;
|
|
4
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const schemaCache_js_1 = require("../utils/schemaCache.js");
|
|
6
|
+
const templateGenerators_js_1 = require("../utils/templateGenerators.js");
|
|
7
|
+
const recommendations_js_1 = require("../utils/recommendations.js");
|
|
8
|
+
function getFEOYamlSetupTemplateTool() {
|
|
9
|
+
async function tool(args) {
|
|
10
|
+
try {
|
|
11
|
+
const { appName, displayTitle, bundle, description, includeNavigation = true, includeServiceTiles = true, includeSearch = true } = args;
|
|
12
|
+
if (!appName || !displayTitle || !bundle) {
|
|
13
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, 'Missing required parameters: appName, displayTitle, and bundle are required');
|
|
14
|
+
}
|
|
15
|
+
const finalDescription = description || `[Brief description of what ${displayTitle} does]`;
|
|
16
|
+
// Ensure schema is loaded
|
|
17
|
+
await (0, schemaCache_js_1.ensureSchemaLoaded)();
|
|
18
|
+
const serviceSection = (0, recommendations_js_1.getRecommendedServiceSection)(bundle);
|
|
19
|
+
const template = (0, templateGenerators_js_1.generateSmartTemplate)('full', {
|
|
20
|
+
appName,
|
|
21
|
+
bundle,
|
|
22
|
+
title: displayTitle,
|
|
23
|
+
position: (0, recommendations_js_1.getRecommendedPosition)(bundle),
|
|
24
|
+
section: serviceSection.section,
|
|
25
|
+
group: serviceSection.group,
|
|
26
|
+
icon: (0, recommendations_js_1.getRecommendedIcon)(bundle),
|
|
27
|
+
productName: (0, recommendations_js_1.getProductName)(bundle),
|
|
28
|
+
manifestLocation: `/apps/${appName}/fed-mods.json`,
|
|
29
|
+
documentTitle: `${displayTitle} | Red Hat Hybrid Cloud Console`,
|
|
30
|
+
routes: [{ pathname: `/${bundle}/${appName}`, props: { bundle } }],
|
|
31
|
+
includeNavigation,
|
|
32
|
+
includeServiceTiles,
|
|
33
|
+
includeSearch,
|
|
34
|
+
description: finalDescription
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: `# Complete Frontend.yaml Template
|
|
41
|
+
|
|
42
|
+
Generated for: **${displayTitle}** (${appName})
|
|
43
|
+
Bundle: **${bundle}**
|
|
44
|
+
|
|
45
|
+
## Template
|
|
46
|
+
|
|
47
|
+
\`\`\`yaml
|
|
48
|
+
${template}
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
## Next Steps
|
|
52
|
+
|
|
53
|
+
1. **Save** this as \`deploy/frontend.yaml\` in your repository
|
|
54
|
+
2. **Update values**:
|
|
55
|
+
- Replace \`[PRODUCTION-API-KEY]\` with your analytics key
|
|
56
|
+
- Replace \`[DEVELOPMENT-API-KEY]\` with your dev analytics key
|
|
57
|
+
- Adjust position value based on desired navigation placement
|
|
58
|
+
- Customize description and alt_title entries
|
|
59
|
+
3. **Validate**:
|
|
60
|
+
\`\`\`bash
|
|
61
|
+
npm run build # Will validate schema
|
|
62
|
+
\`\`\`
|
|
63
|
+
4. **Test** in development environment
|
|
64
|
+
5. **Deploy** to staging/production`,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (error instanceof types_js_1.McpError) {
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Error generating YAML setup template: ${error instanceof Error ? error.message : String(error)}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [
|
|
77
|
+
'getFEOYamlSetupTemplate',
|
|
78
|
+
{
|
|
79
|
+
description: 'Generate complete frontend.yaml template for new applications',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
appName: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'Application name in kebab-case (e.g., "my-new-app")',
|
|
86
|
+
},
|
|
87
|
+
displayTitle: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
description: 'Human-readable application title',
|
|
90
|
+
},
|
|
91
|
+
bundle: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Target bundle (insights, openshift, ansible, settings, etc.)',
|
|
94
|
+
},
|
|
95
|
+
description: {
|
|
96
|
+
type: 'string',
|
|
97
|
+
description: 'Brief description of what the application does',
|
|
98
|
+
},
|
|
99
|
+
includeNavigation: {
|
|
100
|
+
type: 'boolean',
|
|
101
|
+
description: 'Include navigation bundle segment (default: true)',
|
|
102
|
+
},
|
|
103
|
+
includeServiceTiles: {
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
description: 'Include service tiles configuration (default: true)',
|
|
106
|
+
},
|
|
107
|
+
includeSearch: {
|
|
108
|
+
type: 'boolean',
|
|
109
|
+
description: 'Include search entries (default: true)',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
required: ['appName', 'displayTitle', 'bundle'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
tool
|
|
116
|
+
];
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateFEOConfig.d.ts","sourceRoot":"","sources":["../../../src/lib/tools/validateFEOConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAItC,wBAAgB,qBAAqB,IAAI,OAAO,CA6G/C"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateFEOConfigTool = validateFEOConfigTool;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const yaml_1 = tslib_1.__importDefault(require("yaml"));
|
|
6
|
+
const ajv_1 = tslib_1.__importDefault(require("ajv"));
|
|
7
|
+
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
8
|
+
const schemaCache_js_1 = require("../utils/schemaCache.js");
|
|
9
|
+
const contentProviders_js_1 = require("../utils/contentProviders.js");
|
|
10
|
+
function validateFEOConfigTool() {
|
|
11
|
+
async function tool(args) {
|
|
12
|
+
try {
|
|
13
|
+
const { yamlContent, skipSchemaFetch = false } = args;
|
|
14
|
+
if (!yamlContent) {
|
|
15
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, 'Missing required parameter: yamlContent');
|
|
16
|
+
}
|
|
17
|
+
// Parse YAML
|
|
18
|
+
let parsed;
|
|
19
|
+
try {
|
|
20
|
+
parsed = yaml_1.default.parse(yamlContent);
|
|
21
|
+
}
|
|
22
|
+
catch (parseError) {
|
|
23
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InvalidParams, `YAML Parse Error: ${parseError instanceof Error ? parseError.message : String(parseError)}`);
|
|
24
|
+
}
|
|
25
|
+
// Get schema for validation
|
|
26
|
+
if (!skipSchemaFetch) {
|
|
27
|
+
await (0, schemaCache_js_1.ensureSchemaLoaded)();
|
|
28
|
+
}
|
|
29
|
+
if (!schemaCache_js_1.cachedSchema) {
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: 'Warning: Schema validation skipped (schema not available)',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Validate against schema
|
|
40
|
+
const ajv = new ajv_1.default({ allErrors: true, strict: false });
|
|
41
|
+
const validate = ajv.compile(schemaCache_js_1.cachedSchema);
|
|
42
|
+
const isValid = validate(parsed);
|
|
43
|
+
let result = `# FEO Configuration Validation
|
|
44
|
+
|
|
45
|
+
## YAML Parse: ✅ Valid YAML structure
|
|
46
|
+
|
|
47
|
+
## Schema Validation: ${isValid ? '✅ Valid' : '❌ Invalid'}
|
|
48
|
+
`;
|
|
49
|
+
if (!isValid && validate.errors) {
|
|
50
|
+
result += `
|
|
51
|
+
## Validation Errors:
|
|
52
|
+
${validate.errors.map(error => `- **${error.instancePath || 'root'}**: ${error.message}`).join('\n')}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
// Additional checks
|
|
56
|
+
const additionalChecks = (0, contentProviders_js_1.performAdditionalChecks)(parsed);
|
|
57
|
+
if (additionalChecks.length > 0) {
|
|
58
|
+
result += `
|
|
59
|
+
## Additional Recommendations:
|
|
60
|
+
${additionalChecks.map(check => `- ${check}`).join('\n')}
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: 'text',
|
|
67
|
+
text: result,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error instanceof types_js_1.McpError) {
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
throw new types_js_1.McpError(types_js_1.ErrorCode.InternalError, `Error validating FEO config: ${error instanceof Error ? error.message : String(error)}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return [
|
|
80
|
+
'validateFEOConfig',
|
|
81
|
+
{
|
|
82
|
+
description: 'Validate frontend.yaml configuration against FEO schema',
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
properties: {
|
|
86
|
+
yamlContent: {
|
|
87
|
+
type: 'string',
|
|
88
|
+
description: 'YAML content to validate',
|
|
89
|
+
},
|
|
90
|
+
skipSchemaFetch: {
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
description: 'Skip fetching latest schema and use cached version (default: false)',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
required: ['yamlContent'],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
tool
|
|
99
|
+
];
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,GAAG,CAAA;CAAE,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function getMigrationSteps(migrationType: string): string;
|
|
2
|
+
export declare function getExamplesByType(type: string, bundle?: string): string;
|
|
3
|
+
export declare function performAdditionalChecks(config: any): string[];
|
|
4
|
+
export declare function getBestPracticesByCategory(category: string): string;
|
|
5
|
+
export declare function getNavigationPositioningGuidance(bundle?: string): string;
|
|
6
|
+
export declare function getServiceTilesSections(): string;
|
|
7
|
+
//# sourceMappingURL=contentProviders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentProviders.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/contentProviders.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CA4B/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAgDvE;AAuDD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,EAAE,CAe7D;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED,wBAAgB,gCAAgC,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD"}
|