@ui5/mcp-server 0.1.0
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/CHANGELOG.md +9 -0
- package/LICENSE +201 -0
- package/LICENSES/Apache-2.0.txt +73 -0
- package/README.md +131 -0
- package/bin/ui5mcp.js +2 -0
- package/lib/Context.d.ts +28 -0
- package/lib/Context.js +71 -0
- package/lib/Context.js.map +1 -0
- package/lib/api.d.ts +3 -0
- package/lib/api.js +3 -0
- package/lib/api.js.map +1 -0
- package/lib/cli.d.ts +1 -0
- package/lib/cli.js +12 -0
- package/lib/cli.js.map +1 -0
- package/lib/registerTools.d.ts +133 -0
- package/lib/registerTools.js +59 -0
- package/lib/registerTools.js.map +1 -0
- package/lib/resources/documentation/getDocumentation.d.ts +18 -0
- package/lib/resources/documentation/getDocumentation.js +70 -0
- package/lib/resources/documentation/getDocumentation.js.map +1 -0
- package/lib/server.d.ts +10 -0
- package/lib/server.js +113 -0
- package/lib/server.js.map +1 -0
- package/lib/tools/create_ui5_app/ODataMetadata.d.ts +55 -0
- package/lib/tools/create_ui5_app/ODataMetadata.js +99 -0
- package/lib/tools/create_ui5_app/ODataMetadata.js.map +1 -0
- package/lib/tools/create_ui5_app/createSuccessMessage.d.ts +13 -0
- package/lib/tools/create_ui5_app/createSuccessMessage.js +45 -0
- package/lib/tools/create_ui5_app/createSuccessMessage.js.map +1 -0
- package/lib/tools/create_ui5_app/create_ui5_app.d.ts +8 -0
- package/lib/tools/create_ui5_app/create_ui5_app.js +273 -0
- package/lib/tools/create_ui5_app/create_ui5_app.js.map +1 -0
- package/lib/tools/create_ui5_app/index.d.ts +3 -0
- package/lib/tools/create_ui5_app/index.js +58 -0
- package/lib/tools/create_ui5_app/index.js.map +1 -0
- package/lib/tools/create_ui5_app/isValidUrl.d.ts +16 -0
- package/lib/tools/create_ui5_app/isValidUrl.js +59 -0
- package/lib/tools/create_ui5_app/isValidUrl.js.map +1 -0
- package/lib/tools/create_ui5_app/schema.d.ts +135 -0
- package/lib/tools/create_ui5_app/schema.js +67 -0
- package/lib/tools/create_ui5_app/schema.js.map +1 -0
- package/lib/tools/create_ui5_app/templateProcessor.d.ts +67 -0
- package/lib/tools/create_ui5_app/templateProcessor.js +59 -0
- package/lib/tools/create_ui5_app/templateProcessor.js.map +1 -0
- package/lib/tools/create_ui5_app/ui5Version.d.ts +2 -0
- package/lib/tools/create_ui5_app/ui5Version.js +6 -0
- package/lib/tools/create_ui5_app/ui5Version.js.map +1 -0
- package/lib/tools/get_api_reference/createUriForSymbol.d.ts +2 -0
- package/lib/tools/get_api_reference/createUriForSymbol.js +49 -0
- package/lib/tools/get_api_reference/createUriForSymbol.js.map +1 -0
- package/lib/tools/get_api_reference/getApiReference.d.ts +10 -0
- package/lib/tools/get_api_reference/getApiReference.js +51 -0
- package/lib/tools/get_api_reference/getApiReference.js.map +1 -0
- package/lib/tools/get_api_reference/index.d.ts +3 -0
- package/lib/tools/get_api_reference/index.js +38 -0
- package/lib/tools/get_api_reference/index.js.map +1 -0
- package/lib/tools/get_api_reference/lib/ApiReferenceProvider.d.ts +85 -0
- package/lib/tools/get_api_reference/lib/ApiReferenceProvider.js +452 -0
- package/lib/tools/get_api_reference/lib/ApiReferenceProvider.js.map +1 -0
- package/lib/tools/get_api_reference/lib/apiReferenceResources.d.ts +18 -0
- package/lib/tools/get_api_reference/lib/apiReferenceResources.js +138 -0
- package/lib/tools/get_api_reference/lib/apiReferenceResources.js.map +1 -0
- package/lib/tools/get_api_reference/lib/formatSymbol.d.ts +24 -0
- package/lib/tools/get_api_reference/lib/formatSymbol.js +109 -0
- package/lib/tools/get_api_reference/lib/formatSymbol.js.map +1 -0
- package/lib/tools/get_api_reference/schema.d.ts +16 -0
- package/lib/tools/get_api_reference/schema.js +12 -0
- package/lib/tools/get_api_reference/schema.js.map +1 -0
- package/lib/tools/get_guidelines/guidelines.d.ts +1 -0
- package/lib/tools/get_guidelines/guidelines.js +6 -0
- package/lib/tools/get_guidelines/guidelines.js.map +1 -0
- package/lib/tools/get_guidelines/index.d.ts +3 -0
- package/lib/tools/get_guidelines/index.js +30 -0
- package/lib/tools/get_guidelines/index.js.map +1 -0
- package/lib/tools/get_project_info/getProjectInfo.d.ts +2 -0
- package/lib/tools/get_project_info/getProjectInfo.js +205 -0
- package/lib/tools/get_project_info/getProjectInfo.js.map +1 -0
- package/lib/tools/get_project_info/index.d.ts +3 -0
- package/lib/tools/get_project_info/index.js +28 -0
- package/lib/tools/get_project_info/index.js.map +1 -0
- package/lib/tools/get_project_info/schema.d.ts +87 -0
- package/lib/tools/get_project_info/schema.js +28 -0
- package/lib/tools/get_project_info/schema.js.map +1 -0
- package/lib/tools/get_version_info/getVersionInfo.d.ts +8 -0
- package/lib/tools/get_version_info/getVersionInfo.js +41 -0
- package/lib/tools/get_version_info/getVersionInfo.js.map +1 -0
- package/lib/tools/get_version_info/index.d.ts +9 -0
- package/lib/tools/get_version_info/index.js +33 -0
- package/lib/tools/get_version_info/index.js.map +1 -0
- package/lib/tools/get_version_info/schema.d.ts +66 -0
- package/lib/tools/get_version_info/schema.js +16 -0
- package/lib/tools/get_version_info/schema.js.map +1 -0
- package/lib/tools/get_version_info/types.d.ts +5 -0
- package/lib/tools/get_version_info/types.js +2 -0
- package/lib/tools/get_version_info/types.js.map +1 -0
- package/lib/tools/run_ui5_linter/index.d.ts +3 -0
- package/lib/tools/run_ui5_linter/index.js +86 -0
- package/lib/tools/run_ui5_linter/index.js.map +1 -0
- package/lib/tools/run_ui5_linter/migrationGuides.d.ts +6 -0
- package/lib/tools/run_ui5_linter/migrationGuides.js +88 -0
- package/lib/tools/run_ui5_linter/migrationGuides.js.map +1 -0
- package/lib/tools/run_ui5_linter/resultContext.d.ts +3 -0
- package/lib/tools/run_ui5_linter/resultContext.js +236 -0
- package/lib/tools/run_ui5_linter/resultContext.js.map +1 -0
- package/lib/tools/run_ui5_linter/runUi5Linter.d.ts +2 -0
- package/lib/tools/run_ui5_linter/runUi5Linter.js +72 -0
- package/lib/tools/run_ui5_linter/runUi5Linter.js.map +1 -0
- package/lib/tools/run_ui5_linter/schema.d.ts +340 -0
- package/lib/tools/run_ui5_linter/schema.js +55 -0
- package/lib/tools/run_ui5_linter/schema.js.map +1 -0
- package/lib/utils/cdnHelper.d.ts +9 -0
- package/lib/utils/cdnHelper.js +50 -0
- package/lib/utils/cdnHelper.js.map +1 -0
- package/lib/utils/dataStorageHelper.d.ts +2 -0
- package/lib/utils/dataStorageHelper.js +65 -0
- package/lib/utils/dataStorageHelper.js.map +1 -0
- package/lib/utils/ui5Framework.d.ts +4 -0
- package/lib/utils/ui5Framework.js +6 -0
- package/lib/utils/ui5Framework.js.map +1 -0
- package/lib/utils.d.ts +10 -0
- package/lib/utils.js +87 -0
- package/lib/utils.js.map +1 -0
- package/npm-shrinkwrap.json +7880 -0
- package/package.json +121 -0
- package/resources/docs/1.136.7/00737d6c1b864dc3ab72ef56611491c4.md +155 -0
- package/resources/docs/1.136.7/0187ea5e2eff4166b0453b9dcc8fc64f.md +164 -0
- package/resources/docs/1.136.7/032be2cb2e1d4115af20862673bedcdb.md +12 -0
- package/resources/docs/1.136.7/28fcd55b04654977b63dacbee0552712.md +317 -0
- package/resources/docs/1.136.7/676b636446c94eada183b1218a824717.md +135 -0
- package/resources/docs/1.136.7/a87ca843bcee469f82a9072927a7dcdb.md +355 -0
- package/resources/docs/1.136.7/b0fb4de7364f4bcbb053a99aa645affe.md +126 -0
- package/resources/docs/1.136.7/fe1a6dba940e479fb7c3bc753f92b28c.md +670 -0
- package/resources/docs/1.136.7/index.json +58 -0
- package/resources/guidelines.md +104 -0
- package/resources/migrationGuides/deprecated-controller-factory.md +116 -0
- package/resources/migrationGuides/deprecated-getLibraryResourceBundle.md +62 -0
- package/resources/migrationGuides/deprecated-jquery-sap-require.md +141 -0
- package/resources/migrationGuides/deprecated-messagePage.md +162 -0
- package/resources/migrationGuides/deprecated-table-table-property.md +154 -0
- package/resources/template-js/LICENSE +201 -0
- package/resources/template-js/README.md +87 -0
- package/resources/template-js/_.editorconfig +22 -0
- package/resources/template-js/_.gitignore +17 -0
- package/resources/template-js/eslint.config.js +68 -0
- package/resources/template-js/karma-ci-cov.conf.js +20 -0
- package/resources/template-js/karma-ci.conf.js +9 -0
- package/resources/template-js/karma.conf.js +9 -0
- package/resources/template-js/package.json +34 -0
- package/resources/template-js/ui5-dist.yaml +18 -0
- package/resources/template-js/ui5.yaml +24 -0
- package/resources/template-js/webapp/Component.js +41 -0
- package/resources/template-js/webapp/controller/App.controller.js +10 -0
- package/resources/template-js/webapp/controller/BaseController.js +67 -0
- package/resources/template-js/webapp/controller/Main.controller.js +14 -0
- package/resources/template-js/webapp/i18n/i18n.properties +3 -0
- package/resources/template-js/webapp/i18n/i18n_en.properties +3 -0
- package/resources/template-js/webapp/index-cdn.html +34 -0
- package/resources/template-js/webapp/index.html +34 -0
- package/resources/template-js/webapp/manifest.json +103 -0
- package/resources/template-js/webapp/model/formatter.js +9 -0
- package/resources/template-js/webapp/model/models.js +11 -0
- package/resources/template-js/webapp/test/Test.qunit.html +16 -0
- package/resources/template-js/webapp/test/integration/HelloJourney.js +85 -0
- package/resources/template-js/webapp/test/integration/opaTests.qunit.js +1 -0
- package/resources/template-js/webapp/test/integration/pages/Main.js +112 -0
- package/resources/template-js/webapp/test/testsuite.qunit.html +18 -0
- package/resources/template-js/webapp/test/testsuite.qunit.js +37 -0
- package/resources/template-js/webapp/test/unit/controller/Main.qunit.js +11 -0
- package/resources/template-js/webapp/test/unit/unitTests.qunit.js +1 -0
- package/resources/template-js/webapp/test-lt1_124/integration/HelloJourney.js +85 -0
- package/resources/template-js/webapp/test-lt1_124/integration/opaTests.qunit.html +31 -0
- package/resources/template-js/webapp/test-lt1_124/integration/opaTests.qunit.js +11 -0
- package/resources/template-js/webapp/test-lt1_124/integration/pages/Main.js +112 -0
- package/resources/template-js/webapp/test-lt1_124/testsuite.qunit.html +13 -0
- package/resources/template-js/webapp/test-lt1_124/testsuite.qunit.js +9 -0
- package/resources/template-js/webapp/test-lt1_124/unit/controller/Main.qunit.js +11 -0
- package/resources/template-js/webapp/test-lt1_124/unit/unitTests.qunit.html +30 -0
- package/resources/template-js/webapp/test-lt1_124/unit/unitTests.qunit.js +12 -0
- package/resources/template-js/webapp/view/App.view.xml +9 -0
- package/resources/template-js/webapp/view/Main.view.xml +90 -0
- package/resources/template-ts/LICENSE +201 -0
- package/resources/template-ts/README.md +101 -0
- package/resources/template-ts/_.editorconfig +23 -0
- package/resources/template-ts/_.gitignore +18 -0
- package/resources/template-ts/_.nycrc.json +7 -0
- package/resources/template-ts/_tsconfig.json +21 -0
- package/resources/template-ts/eslint.config.mjs +27 -0
- package/resources/template-ts/package.json +40 -0
- package/resources/template-ts/ui5-coverage.yaml +40 -0
- package/resources/template-ts/ui5-dist.yaml +18 -0
- package/resources/template-ts/ui5.yaml +27 -0
- package/resources/template-ts/webapp/Component.ts +49 -0
- package/resources/template-ts/webapp/controller/App.controller.ts +11 -0
- package/resources/template-ts/webapp/controller/BaseController.ts +83 -0
- package/resources/template-ts/webapp/controller/Main.controller.ts +19 -0
- package/resources/template-ts/webapp/i18n/i18n.properties +3 -0
- package/resources/template-ts/webapp/i18n/i18n_en.properties +3 -0
- package/resources/template-ts/webapp/index-cdn.html +35 -0
- package/resources/template-ts/webapp/index.html +35 -0
- package/resources/template-ts/webapp/manifest.json +105 -0
- package/resources/template-ts/webapp/model/formatter.ts +5 -0
- package/resources/template-ts/webapp/model/models.ts +15 -0
- package/resources/template-ts/webapp/test/Test.qunit.html +16 -0
- package/resources/template-ts/webapp/test/integration/HelloJourney.ts +84 -0
- package/resources/template-ts/webapp/test/integration/opaTests.qunit.ts +2 -0
- package/resources/template-ts/webapp/test/integration/pages/MainPage.ts +112 -0
- package/resources/template-ts/webapp/test/testsuite.qunit.html +18 -0
- package/resources/template-ts/webapp/test/testsuite.qunit.ts +33 -0
- package/resources/template-ts/webapp/test/unit/controller/Main.qunit.ts +8 -0
- package/resources/template-ts/webapp/test/unit/unitTests.qunit.ts +2 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/HelloJourney.ts +86 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/opaTests.qunit.html +34 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/opaTests.qunit.ts +8 -0
- package/resources/template-ts/webapp/test-lt1_124/integration/pages/MainPage.ts +112 -0
- package/resources/template-ts/webapp/test-lt1_124/testsuite.qunit.html +13 -0
- package/resources/template-ts/webapp/test-lt1_124/testsuite.qunit.ts +9 -0
- package/resources/template-ts/webapp/test-lt1_124/unit/controller/Main.qunit.ts +8 -0
- package/resources/template-ts/webapp/test-lt1_124/unit/unitTests.qunit.html +37 -0
- package/resources/template-ts/webapp/test-lt1_124/unit/unitTests.qunit.ts +8 -0
- package/resources/template-ts/webapp/view/App.view.xml +9 -0
- package/resources/template-ts/webapp/view/Main.view.xml +90 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { fetchCdn, getBaseUrl } from "../../utils/cdnHelper.js";
|
|
2
|
+
import { Mutex } from "async-mutex";
|
|
3
|
+
import { getLogger } from "@ui5/logger";
|
|
4
|
+
const log = getLogger("tools:get_version_info:getVersionInfo");
|
|
5
|
+
const cachedVersionInfo = new Map();
|
|
6
|
+
const versionInfoMutex = new Mutex();
|
|
7
|
+
/**
|
|
8
|
+
* Fetch version information for the specified UI5 framework
|
|
9
|
+
* @param framework The UI5 framework (OpenUI5 or SAPUI5)
|
|
10
|
+
* @returns The version information
|
|
11
|
+
* @throws {Error} If the version information cannot be fetched
|
|
12
|
+
*/
|
|
13
|
+
export default async function getVersionInfo(params) {
|
|
14
|
+
if (cachedVersionInfo.has(params.frameworkName)) {
|
|
15
|
+
return { versions: cachedVersionInfo.get(params.frameworkName) };
|
|
16
|
+
}
|
|
17
|
+
const release = await versionInfoMutex.acquire();
|
|
18
|
+
try {
|
|
19
|
+
// Check again inside the mutex
|
|
20
|
+
if (cachedVersionInfo.has(params.frameworkName)) {
|
|
21
|
+
return { versions: cachedVersionInfo.get(params.frameworkName) };
|
|
22
|
+
}
|
|
23
|
+
const baseUrl = getBaseUrl(params.frameworkName);
|
|
24
|
+
const url = `${baseUrl}/version.json`;
|
|
25
|
+
log.info(`Fetching version information for ${params.frameworkName} from ${url}`);
|
|
26
|
+
const data = await fetchCdn(url);
|
|
27
|
+
const versions = processVersionJson(data);
|
|
28
|
+
cachedVersionInfo.set(params.frameworkName, versions);
|
|
29
|
+
return { versions };
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
release();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function processVersionJson(rawJsonData) {
|
|
36
|
+
if (!rawJsonData || typeof rawJsonData !== "object" || Array.isArray(rawJsonData)) {
|
|
37
|
+
throw new Error("Invalid version.json format. Expected an object.");
|
|
38
|
+
}
|
|
39
|
+
return rawJsonData;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=getVersionInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVersionInfo.js","sourceRoot":"","sources":["../../../src/tools/get_version_info/getVersionInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,GAAG,GAAG,SAAS,CAAC,uCAAuC,CAAC,CAAC;AAE/D,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAuB,CAAC;AACzD,MAAM,gBAAgB,GAAG,IAAI,KAAK,EAAE,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,cAAc,CAAC,MAA4B;IACxE,IAAI,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACjD,OAAO,EAAC,QAAQ,EAAE,iBAAiB,CAAC,G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data from the respective version.json files.
|
|
6
|
+
*/
|
|
7
|
+
import Context from "../../Context.js";
|
|
8
|
+
import { RegisterTool } from "../../registerTools.js";
|
|
9
|
+
export default function registerTool(registerTool: RegisterTool, _context: Context): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI5 Version Info Tool
|
|
3
|
+
*
|
|
4
|
+
* This tool provides version information for UI5 (OpenUI5 and SAPUI5)
|
|
5
|
+
* by fetching data from the respective version.json files.
|
|
6
|
+
*/
|
|
7
|
+
import getVersionInfo from "./getVersionInfo.js";
|
|
8
|
+
import { inputSchema, outputSchema } from "./schema.js";
|
|
9
|
+
import { getLogger } from "@ui5/logger";
|
|
10
|
+
const log = getLogger("tools:get_version_info");
|
|
11
|
+
export default function registerTool(registerTool, _context) {
|
|
12
|
+
registerTool("get_version_info", {
|
|
13
|
+
description: "Get version information for UI5 (OpenUI5 or SAPUI5)",
|
|
14
|
+
annotations: {
|
|
15
|
+
title: "UI5 Version Info",
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
idempotentHint: true,
|
|
18
|
+
},
|
|
19
|
+
inputSchema,
|
|
20
|
+
outputSchema,
|
|
21
|
+
}, async (toolParams) => {
|
|
22
|
+
log.info(`Retrieving version info for framework '${toolParams.frameworkName}'`);
|
|
23
|
+
const versionInfo = await getVersionInfo(toolParams);
|
|
24
|
+
return {
|
|
25
|
+
content: [{
|
|
26
|
+
type: "text",
|
|
27
|
+
text: JSON.stringify(versionInfo, null, 2),
|
|
28
|
+
}],
|
|
29
|
+
structuredContent: versionInfo,
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/get_version_info/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,MAAM,GAAG,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,YAA0B,EAAE,QAAiB;IACjF,YAAY,CAAC,kBAAkB,EAAE;QAChC,WAAW,EAAE,qDAAqD;QAClE,WAAW,EAAE;YACZ,KAAK,EAAE,kBAAkB;YACzB,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IAAI;SACpB;QACD,WAAW;QACX,YAAY;KACZ,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;QACvB,GAAG,CAAC,IAAI,CAAC,0CAA0C,UAAU,CAAC,aAAa,GAAG,CAAC,CAAC;QAChF,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO;YACN,OAAO,EAAE,CAAC;oBACT,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC1C,CAAC;YACF,iBAAiB,EAAE,WAAW;SAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const inputSchema: {
|
|
3
|
+
frameworkName: z.ZodEnum<["OpenUI5", "SAPUI5"]>;
|
|
4
|
+
};
|
|
5
|
+
export declare const inputSchemaObject: z.ZodObject<{
|
|
6
|
+
frameworkName: z.ZodEnum<["OpenUI5", "SAPUI5"]>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
frameworkName: "OpenUI5" | "SAPUI5";
|
|
9
|
+
}, {
|
|
10
|
+
frameworkName: "OpenUI5" | "SAPUI5";
|
|
11
|
+
}>;
|
|
12
|
+
export declare const versionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
|
+
version: z.ZodString;
|
|
14
|
+
support: z.ZodString;
|
|
15
|
+
lts: z.ZodBoolean;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
version: string;
|
|
18
|
+
support: string;
|
|
19
|
+
lts: boolean;
|
|
20
|
+
}, {
|
|
21
|
+
version: string;
|
|
22
|
+
support: string;
|
|
23
|
+
lts: boolean;
|
|
24
|
+
}>>;
|
|
25
|
+
export declare const outputSchema: {
|
|
26
|
+
versions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
27
|
+
version: z.ZodString;
|
|
28
|
+
support: z.ZodString;
|
|
29
|
+
lts: z.ZodBoolean;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
version: string;
|
|
32
|
+
support: string;
|
|
33
|
+
lts: boolean;
|
|
34
|
+
}, {
|
|
35
|
+
version: string;
|
|
36
|
+
support: string;
|
|
37
|
+
lts: boolean;
|
|
38
|
+
}>>;
|
|
39
|
+
};
|
|
40
|
+
export declare const outputSchemaObject: z.ZodObject<{
|
|
41
|
+
versions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
42
|
+
version: z.ZodString;
|
|
43
|
+
support: z.ZodString;
|
|
44
|
+
lts: z.ZodBoolean;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
version: string;
|
|
47
|
+
support: string;
|
|
48
|
+
lts: boolean;
|
|
49
|
+
}, {
|
|
50
|
+
version: string;
|
|
51
|
+
support: string;
|
|
52
|
+
lts: boolean;
|
|
53
|
+
}>>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
versions: Record<string, {
|
|
56
|
+
version: string;
|
|
57
|
+
support: string;
|
|
58
|
+
lts: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
}, {
|
|
61
|
+
versions: Record<string, {
|
|
62
|
+
version: string;
|
|
63
|
+
support: string;
|
|
64
|
+
lts: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Ui5FrameworkSchema } from "../../utils/ui5Framework.js";
|
|
3
|
+
export const inputSchema = {
|
|
4
|
+
frameworkName: Ui5FrameworkSchema.describe("The UI5 framework to get version information for"),
|
|
5
|
+
};
|
|
6
|
+
export const inputSchemaObject = z.object(inputSchema);
|
|
7
|
+
export const versionsSchema = z.record(z.string(), z.object({
|
|
8
|
+
version: z.string(),
|
|
9
|
+
support: z.string(),
|
|
10
|
+
lts: z.boolean(),
|
|
11
|
+
})).describe("All known versions with their support information");
|
|
12
|
+
export const outputSchema = {
|
|
13
|
+
versions: versionsSchema,
|
|
14
|
+
};
|
|
15
|
+
export const outputSchemaObject = z.object(outputSchema);
|
|
16
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/tools/get_version_info/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,aAAa,EAAE,kBAAkB,CAAC,QAAQ,CAAC,kDAAkD,CAAC;CAC9F,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CACrC,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,MAAM,CAAC;IACR,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE;CAChB,CAAC,CACF,CAAC,QAAQ,CAAC,mDAAmD,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,QAAQ,EAAE,cAAc;CACxB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { inputSchemaObject, outputSchemaObject, versionsSchema } from "./schema.js";
|
|
3
|
+
export type VersionInfo = z.infer<typeof versionsSchema>;
|
|
4
|
+
export type GetVersionInfoParams = z.infer<typeof inputSchemaObject>;
|
|
5
|
+
export type GetVersionInfoResult = z.infer<typeof outputSchemaObject>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tools/get_version_info/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import runUi5Linter from "./runUi5Linter.js";
|
|
2
|
+
import { inputSchema, outputSchema } from "./schema.js";
|
|
3
|
+
import { getLogger } from "@ui5/logger";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
const log = getLogger("tools:run_ui5_linter");
|
|
6
|
+
export default function registerTool(registerTool, context) {
|
|
7
|
+
registerTool("run_ui5_linter", {
|
|
8
|
+
description: "Run UI5 linter on a UI5 project to find and optionally fix UI5 related problems like the usage of " +
|
|
9
|
+
"deprecated API. " +
|
|
10
|
+
"After making changes, you should always run the linter again to verify that no new problems have been " +
|
|
11
|
+
"introduced.",
|
|
12
|
+
annotations: {
|
|
13
|
+
title: "UI5 linter",
|
|
14
|
+
readOnlyHint: false,
|
|
15
|
+
},
|
|
16
|
+
inputSchema,
|
|
17
|
+
outputSchema,
|
|
18
|
+
}, async ({ projectDir, filePatterns, provideContextInformation, fix }) => {
|
|
19
|
+
log.info(`Running UI5 linter on project at ${projectDir}`);
|
|
20
|
+
if (filePatterns) {
|
|
21
|
+
log.info(` File patterns: ${filePatterns.join(", ")}`);
|
|
22
|
+
}
|
|
23
|
+
log.info(` Fix enabled: ${fix}`);
|
|
24
|
+
log.info(` Provide context information: ${provideContextInformation}`);
|
|
25
|
+
const resolvedProjectPath = await context.normalizePath(projectDir);
|
|
26
|
+
const results = await runUi5Linter({
|
|
27
|
+
projectDir: resolvedProjectPath,
|
|
28
|
+
filePatterns,
|
|
29
|
+
provideContextInformation,
|
|
30
|
+
fix,
|
|
31
|
+
});
|
|
32
|
+
const content = [{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: JSON.stringify(results.results, null, 2),
|
|
35
|
+
}];
|
|
36
|
+
if (results.contextInformation) {
|
|
37
|
+
const { ruleDescriptions, documentationResources, migrationGuides, apiReferences } = results.contextInformation;
|
|
38
|
+
if (apiReferences.length) {
|
|
39
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
40
|
+
const projectUri = pathToFileURL(resolvedProjectPath);
|
|
41
|
+
content.push({
|
|
42
|
+
type: "resource",
|
|
43
|
+
resource: {
|
|
44
|
+
uri: `ui5-linter-result://${projectUri.pathname}/api-reference-extract-${timestamp}.json`,
|
|
45
|
+
text: JSON.stringify(apiReferences, null, 2),
|
|
46
|
+
mimeType: "application/json",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
for (const migrationGuide of migrationGuides) {
|
|
51
|
+
content.push({
|
|
52
|
+
type: "resource",
|
|
53
|
+
resource: {
|
|
54
|
+
title: migrationGuide.title,
|
|
55
|
+
text: migrationGuide.text,
|
|
56
|
+
uri: migrationGuide.uri,
|
|
57
|
+
mimeType: "text/markdown",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
;
|
|
62
|
+
for (const doc of documentationResources) {
|
|
63
|
+
content.push({
|
|
64
|
+
type: "resource",
|
|
65
|
+
resource: {
|
|
66
|
+
title: doc.title,
|
|
67
|
+
text: doc.text,
|
|
68
|
+
uri: doc.uri,
|
|
69
|
+
mimeType: "text/markdown",
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (ruleDescriptions.length) {
|
|
74
|
+
content.push({
|
|
75
|
+
type: "text",
|
|
76
|
+
text: JSON.stringify(ruleDescriptions, null, 2),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
content,
|
|
82
|
+
structuredContent: results,
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/run_ui5_linter/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,GAAG,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAE9C,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,YAA0B,EAAE,OAAgB;IAChF,YAAY,CAAC,gBAAgB,EAAE;QAC9B,WAAW,EACV,oGAAoG;YACpG,kBAAkB;YAClB,wGAAwG;YACxG,aAAa;QACd,WAAW,EAAE;YACZ,KAAK,EAAE,YAAY;YACnB,YAAY,EAAE,KAAK;SACnB;QACD,WAAW;QACX,YAAY;KACZ,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,YAAY,EAAE,yBAAyB,EAAE,GAAG,EAAC,EAAE,EAAE;QACvE,GAAG,CAAC,IAAI,CAAC,oCAAoC,UAAU,EAAE,CAAC,CAAC;QAC3D,IAAI,YAAY,EAAE,CAAC;YAClB,GAAG,CAAC,IAAI,CAAC,oBAAoB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzD,CAAC;QACD,GAAG,CAAC,IAAI,C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AAQ,EAAE;wBACT,KAAK,EAAE,cAAc,CAAC,KAAK;wBAC3B,IAAI,EAAE,cAAc,CAAC,IAAI;wBACzB,GAAG,EAAE,cAAc,CAAC,GAAG;wBACvB,QAAQ,EAAE,eAAe;qBACzB;iBACD,CAAC,CAAC;YACJ,CAAC;YAAA,CAAC;YACF,KAAK,MAAM,GAAG,IAAI,sBAAsB,EAAE,CAAC;gBAC1C,OAAO,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE;wBACT,KAAK,EAAE,GAAG,CAAC,KAAK;wBAChB,IAAI,EAAE,GAAG,CAAC,IAAI;wBACd,GAAG,EAAE,GAAG,CAAC,GAAG;wBACZ,QAAQ,EAAE,eAAe;qBACzB;iBACD,CAAC,CAAC;YACJ,CAAC;YACD,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;gBAC7B,OAAO,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC/C,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,OAAO;YACN,OAAO;YACP,iBAAiB,EAAE,OAAO;SAC1B,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Ui5TypeInfoMatcher from "@ui5/linter/Ui5TypeInfoMatcher";
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
export default async function getMigrationGuidesForResults(results) {
|
|
4
|
+
const matchers = new Set();
|
|
5
|
+
matchers.add(createGlobalMigrationGuideMatcher());
|
|
6
|
+
matchers.add(createJqueryMigrationGuideMatcher());
|
|
7
|
+
matchers.add(createSapMMigrationGuideMatcher());
|
|
8
|
+
matchers.add(createSapUiCoreMigrationGuideMatcher());
|
|
9
|
+
matchers.add(createSapUiTableTableMigrationGuideMatcher());
|
|
10
|
+
const migrationGuidesBasePath = new URL(`../../../resources/migrationGuides`, import.meta.url);
|
|
11
|
+
const migrationGuidePaths = new Set();
|
|
12
|
+
for (const result of results) {
|
|
13
|
+
for (const msg of result.messages) {
|
|
14
|
+
if (msg.ui5TypeInfo) {
|
|
15
|
+
const migrationGuidePath = getMigrationGuidePathForUi5TypeInfo(msg.ui5TypeInfo, matchers);
|
|
16
|
+
if (migrationGuidePath) {
|
|
17
|
+
migrationGuidePaths.add(migrationGuidePath);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return await Promise.all(Array.from(migrationGuidePaths).map(async (migrationGuidePath) => {
|
|
23
|
+
const fileUrl = new URL(`${migrationGuidesBasePath}/${migrationGuidePath}`);
|
|
24
|
+
return {
|
|
25
|
+
title: migrationGuidePath,
|
|
26
|
+
text: await readFile(fileUrl, "utf8"),
|
|
27
|
+
uri: `ui5-linter-result://migration-guides/${migrationGuidePath}`,
|
|
28
|
+
};
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
function getMigrationGuidePathForUi5TypeInfo(ui5TypeInfo, matchers) {
|
|
32
|
+
for (const matcher of matchers) {
|
|
33
|
+
const migrationGuidePath = matcher.match(ui5TypeInfo);
|
|
34
|
+
if (migrationGuidePath) {
|
|
35
|
+
return migrationGuidePath;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function createGlobalMigrationGuideMatcher() {
|
|
40
|
+
const m = new Ui5TypeInfoMatcher();
|
|
41
|
+
m.declareNamespace("sap", [
|
|
42
|
+
m.namespace("ui", [
|
|
43
|
+
m.function("controller", "deprecated-controller-factory.md"),
|
|
44
|
+
]),
|
|
45
|
+
]);
|
|
46
|
+
return m;
|
|
47
|
+
}
|
|
48
|
+
function createJqueryMigrationGuideMatcher() {
|
|
49
|
+
/**
|
|
50
|
+
* NOTE: Since jQuery.sap APIs are not fully typed, UI5 linter generates "mocked" UI5 Type Info.
|
|
51
|
+
* To keep it simple, that module simply treats everything as a NAMESPACE.
|
|
52
|
+
*
|
|
53
|
+
* Therefore, the filters expressed below MUST ALWAYS USE NAMESPACE, regardless of the actual type.
|
|
54
|
+
*/
|
|
55
|
+
const m = new Ui5TypeInfoMatcher("jquery");
|
|
56
|
+
m.declareModule("jQuery", [
|
|
57
|
+
m.namespace("sap", [
|
|
58
|
+
m.namespace("declare", "deprecated-jquery-sap-require.md"),
|
|
59
|
+
m.namespace("require", "deprecated-jquery-sap-require.md"),
|
|
60
|
+
]),
|
|
61
|
+
]);
|
|
62
|
+
return m;
|
|
63
|
+
}
|
|
64
|
+
function createSapMMigrationGuideMatcher() {
|
|
65
|
+
const m = new Ui5TypeInfoMatcher("sap.m");
|
|
66
|
+
m.declareModule("sap/m/MessagePage", "deprecated-message-page.md");
|
|
67
|
+
return m;
|
|
68
|
+
}
|
|
69
|
+
function createSapUiCoreMigrationGuideMatcher() {
|
|
70
|
+
const m = new Ui5TypeInfoMatcher("sap.ui.core");
|
|
71
|
+
// TODO: Core.getLibraryResourceBundle => sap.ui.core.Lib.getResourceBundleFor
|
|
72
|
+
return m;
|
|
73
|
+
}
|
|
74
|
+
function createSapUiTableTableMigrationGuideMatcher() {
|
|
75
|
+
const m = new Ui5TypeInfoMatcher("sap.ui.table");
|
|
76
|
+
m.declareModule("sap/ui/table/Table", [
|
|
77
|
+
m.managedObjectSetting("$TableSettings", [
|
|
78
|
+
m.metadataProperty("rowHeight", "deprecated-table-table-property.md"),
|
|
79
|
+
m.metadataProperty("visibleRowCountMode", "deprecated-table-table-property.md"),
|
|
80
|
+
m.metadataProperty("visibleRowCount", "deprecated-table-table-property.md"),
|
|
81
|
+
m.metadataProperty("minAutoRowCount", "deprecated-table-table-property.md"),
|
|
82
|
+
m.metadataProperty("fixedRowCount", "deprecated-table-table-property.md"),
|
|
83
|
+
m.metadataProperty("fixedBottomRowCount", "deprecated-table-table-property.md"),
|
|
84
|
+
]),
|
|
85
|
+
]);
|
|
86
|
+
return m;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=migrationGuides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationGuides.js","sourceRoot":"","sources":["../../../src/tools/run_ui5_linter/migrationGuides.ts"],"names":[],"mappings":"AACA,OAAO,kBAAiC,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAIrC,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,4BAA4B,CAAC,OAAqB;IAC/E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IACjD,QAAQ,CAAC,GAAG,CAAC,iCAAiC,EAAE,CAAC,CAAC;IAClD,QAAQ,CAAC,GAAG,CAAC,iCAAiC,EAAE,CAAC,CAAC;IAClD,QAAQ,CAAC,GAAG,CAAC,+BAA+B,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,GAAG,CAAC,oCAAoC,EAAE,CAAC,CAAC;IACrD,QAAQ,CAAC,GAAG,CAAC,0CAA0C,EAAE,CAAC,CAAC;IAE3D,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,oCAAoC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/F,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9C,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACnC,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;gBACrB,MAAM,kBAAkB,GAAG,mCAAmC,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;gBAC1F,IAAI,kBAAkB,EAAE,CAAC;oBACxB,mBAAmB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;gBAC7C,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,MAAM,OAAO,CAAC,GAA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CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACV,CAAC;AAED,SAAS,+BAA+B;IACvC,MAAM,CAAC,GAAyB,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAEhE,CAAC,CAAC,aAAa,CAAC,mBAAmB,EAAE,4BAA4B,CAAC,CAAC;IACnE,OAAO,CAAC,CAAC;AACV,CAAC;AAED,SAAS,oCAAoC;IAC5C,MAAM,CAAC,GAAyB,IAAI,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACtE,8EAA8E;IAC9E,OAAO,CAAC,CAAC;AACV,CAAC;AAED,SAAS,0CAA0C;IAClD,MAAM,CAAC,GAAyB,IAAI,kBAAkB,CAAC,cAAc,CAAC,CAAC;IACvE,CAAC,CAAC,aAAa,CAAC,oBAAoB,EAAE;QACrC,CAAC,CAAC,oBAAoB,CAAC,gBAAgB,EAAE;YACxC,CAAC,CAAC,gBAAgB,CAAC,WAAW,EAAE,oCAAoC,CAAC;YACrE,CAAC,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,oCAAoC,CAAC;YAC/E,CAAC,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAC3E,CAAC,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAC3E,CAAC,CAAC,gBAAgB,CAAC,eAAe,EAAE,oCAAoC,CAAC;YACzE,CAAC,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,oCAAoC,CAAC;SAC/E,CAAC;KACF,CAAC,CAAC;IACH,OAAO,CAAC,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { NotFoundError } from "../../utils.js";
|
|
2
|
+
import getMigrationGuidesForResults from "./migrationGuides.js";
|
|
3
|
+
import { Ui5TypeInfoKind } from "@ui5/linter/Ui5TypeInfoMatcher";
|
|
4
|
+
import { getApiReferenceSummary, getApiReferenceSummaryForUi5Type } from "../get_api_reference/getApiReference.js";
|
|
5
|
+
import { getLogger } from "@ui5/logger";
|
|
6
|
+
import { getDocumentationByLoio } from "../../resources/documentation/getDocumentation.js";
|
|
7
|
+
const log = getLogger("tools:run_ui5_linter:resultContext");
|
|
8
|
+
const API_REF_FRAMEWORK = "OpenUI5";
|
|
9
|
+
const API_REF_VERSION = "1.136.5"; // Version currently used by UI5 linter
|
|
10
|
+
export async function createResultContext(results) {
|
|
11
|
+
const { ruleIds, moduleNames, topics, relevantUi5Types } = groupResults(results);
|
|
12
|
+
const ruleDescriptions = getRuleDescriptions(ruleIds, topics);
|
|
13
|
+
const apiReferences = await getApiReferences(relevantUi5Types, topics, moduleNames);
|
|
14
|
+
const migrationGuides = await getMigrationGuidesForResults(results);
|
|
15
|
+
const documentationResources = await getDocumentationReferences(topics);
|
|
16
|
+
return {
|
|
17
|
+
ruleDescriptions,
|
|
18
|
+
apiReferences,
|
|
19
|
+
documentationResources,
|
|
20
|
+
migrationGuides,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function groupResults(result) {
|
|
24
|
+
// Collect rules for errors
|
|
25
|
+
const ruleIds = new Set();
|
|
26
|
+
const moduleNames = new Set();
|
|
27
|
+
const relevantUi5Types = new Set();
|
|
28
|
+
const topics = new Set();
|
|
29
|
+
const uniqueMessageDetails = new Set();
|
|
30
|
+
for (const res of result) {
|
|
31
|
+
res.messages.forEach((message) => {
|
|
32
|
+
ruleIds.add(message.ruleId);
|
|
33
|
+
const ui5TypeInfo = message.ui5TypeInfo;
|
|
34
|
+
if (ui5TypeInfo) {
|
|
35
|
+
const moduleName = getModuleNameForTypeInfo(ui5TypeInfo);
|
|
36
|
+
if (moduleName) {
|
|
37
|
+
moduleNames.add(moduleName);
|
|
38
|
+
}
|
|
39
|
+
relevantUi5Types.add(ui5TypeInfo);
|
|
40
|
+
}
|
|
41
|
+
// Extract anything that remotely looks like a module name from the message details
|
|
42
|
+
if (message.messageDetails) {
|
|
43
|
+
if (uniqueMessageDetails.has(message.messageDetails)) {
|
|
44
|
+
// Already processed this message details, skip and remove from message
|
|
45
|
+
message.messageDetails = "";
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
uniqueMessageDetails.add(message.messageDetails);
|
|
49
|
+
// Remove line-breaks from message details
|
|
50
|
+
message.messageDetails = message.messageDetails.replace(/\r?\n/g, " ");
|
|
51
|
+
findModuleNames(message.messageDetails, moduleNames);
|
|
52
|
+
findTopicReferences(message.messageDetails, topics);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
ruleIds,
|
|
59
|
+
moduleNames,
|
|
60
|
+
topics,
|
|
61
|
+
relevantUi5Types,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function getModuleNameForTypeInfo(ui5TypeInfo) {
|
|
65
|
+
if (ui5TypeInfo.kind === Ui5TypeInfoKind.Module) {
|
|
66
|
+
return ui5TypeInfo.name;
|
|
67
|
+
}
|
|
68
|
+
while ("parent" in ui5TypeInfo && ui5TypeInfo.parent) {
|
|
69
|
+
if (ui5TypeInfo.parent.kind === Ui5TypeInfoKind.Module) {
|
|
70
|
+
return ui5TypeInfo.parent.name;
|
|
71
|
+
}
|
|
72
|
+
ui5TypeInfo = ui5TypeInfo.parent;
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
function getRuleDescriptions(ruleIds, topics) {
|
|
77
|
+
const ruleDescriptions = [];
|
|
78
|
+
for (const ruleId of ruleIds) {
|
|
79
|
+
const ref = RULE_REFERENCES[ruleId];
|
|
80
|
+
let text;
|
|
81
|
+
if (typeof ref === "string") {
|
|
82
|
+
text = ref;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
text = ref.text;
|
|
86
|
+
for (const topic of ref.topics) {
|
|
87
|
+
topics.add(topic);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
ruleDescriptions.push({
|
|
91
|
+
ruleId,
|
|
92
|
+
description: text,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return ruleDescriptions;
|
|
96
|
+
}
|
|
97
|
+
async function getApiReferences(relevantUi5Types, topics, moduleNames) {
|
|
98
|
+
const apiReferences = [];
|
|
99
|
+
for (const ui5TypeInfo of relevantUi5Types) {
|
|
100
|
+
try {
|
|
101
|
+
// Framework and version must match the version used in UI5 linter
|
|
102
|
+
const apiReference = await getApiReferenceSummaryForUi5Type(ui5TypeInfo, API_REF_FRAMEWORK, API_REF_VERSION);
|
|
103
|
+
findTopicReferences(JSON.stringify(apiReference), topics);
|
|
104
|
+
if (apiReference.deprecatedText && typeof apiReference.deprecatedText === "string") {
|
|
105
|
+
// Examples texts:
|
|
106
|
+
// > Please use {@link sap.ui.core.Element.getElementById Element.getElementById} instead
|
|
107
|
+
// > Use the {@link sap.m.Avatar} instead
|
|
108
|
+
findModuleNames(apiReference.deprecatedText, moduleNames);
|
|
109
|
+
}
|
|
110
|
+
apiReferences.push(apiReference);
|
|
111
|
+
}
|
|
112
|
+
catch (_err) {
|
|
113
|
+
// Ignore errors, since module might not exist in API reference
|
|
114
|
+
// We only want to provide hints, so it's not a problem if something is missing
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Add short references for all module names
|
|
119
|
+
for (const moduleName of moduleNames) {
|
|
120
|
+
try {
|
|
121
|
+
const res = await getApiReferenceSummary(moduleName, API_REF_FRAMEWORK, API_REF_VERSION);
|
|
122
|
+
if (res) {
|
|
123
|
+
apiReferences.push(...res);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (_err) {
|
|
127
|
+
// Ignore errors, since module might not exist in API reference
|
|
128
|
+
// We only want to provide hints, so it's not a problem if something is missing
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// De-duplicate compact API references
|
|
133
|
+
const uniqueApiReferences = new Map();
|
|
134
|
+
for (const apiReference of apiReferences) {
|
|
135
|
+
const key = `${apiReference.module ?? "<no-module>"}-${apiReference.kind}-${apiReference.name}}`;
|
|
136
|
+
if (!uniqueApiReferences.has(key)) {
|
|
137
|
+
uniqueApiReferences.set(key, apiReference);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return Array.from(uniqueApiReferences.values());
|
|
141
|
+
}
|
|
142
|
+
async function getDocumentationReferences(topics) {
|
|
143
|
+
const documentationResources = [];
|
|
144
|
+
for (const topic of topics) {
|
|
145
|
+
try {
|
|
146
|
+
const doc = await getDocumentationByLoio(topic);
|
|
147
|
+
if (doc) {
|
|
148
|
+
documentationResources.push(doc);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
if (err instanceof NotFoundError) {
|
|
153
|
+
log.verbose(`Failed to get documentation for topic ${topic}: ${err.message}`);
|
|
154
|
+
// Ignore not-found errors that occur during linter result collection
|
|
155
|
+
// No need to report them to the LLM, since they might be caused by
|
|
156
|
+
// incorrect JSDoc
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
throw err;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return documentationResources;
|
|
163
|
+
}
|
|
164
|
+
// Examples for module names: "sap.m.Avatar", "sap/ui/core/Component", "sap.ui.model.odata.v2.ODataModel"
|
|
165
|
+
const MODULE_NAME_REGEX = /sap(?:[./][a-zA-Z0-9_]+)+/g;
|
|
166
|
+
function findModuleNames(text, moduleNames) {
|
|
167
|
+
// Find all module names in the text
|
|
168
|
+
const matches = text.matchAll(MODULE_NAME_REGEX);
|
|
169
|
+
for (const match of matches) {
|
|
170
|
+
const moduleName = match[0]; // Use the whole match (no group)
|
|
171
|
+
moduleNames.add(moduleName);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Example: https://ui5.sap.com/#/topic/a075ed88ef324261bca41813a6ac4a1c?q=Replacement%20of%20Deprecated%20jQuery%20APIs
|
|
175
|
+
const LOIO_ID_URL_REGEX = /https:\/\/ui5\.sap\.com\/#\/topic\/([a-zA-Z0-9-]+)/g;
|
|
176
|
+
function findTopicReferences(text, topics) {
|
|
177
|
+
const matches = text.matchAll(LOIO_ID_URL_REGEX);
|
|
178
|
+
for (const match of matches) {
|
|
179
|
+
const topic = match[1];
|
|
180
|
+
topics.add(topic);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const RULE_REFERENCES = {
|
|
184
|
+
"async-component-flags": {
|
|
185
|
+
text: `Components must be configured for asynchronous loading via the \`sap.ui.core.IAsyncContentCreation\` interface in the Component metadata or via \`async\` flags in the \`manifest.json\``,
|
|
186
|
+
topics: ["676b636446c94eada183b1218a824717", "0187ea5e2eff4166b0453b9dcc8fc64f"],
|
|
187
|
+
},
|
|
188
|
+
"csp-unsafe-inline-script": {
|
|
189
|
+
text: `Inline scripts in HTML files must not be used in accordance with Content Security Policy (CSP) best practices`,
|
|
190
|
+
topics: ["fe1a6dba940e479fb7c3bc753f92b28c"],
|
|
191
|
+
},
|
|
192
|
+
"no-ambiguous-event-handler": {
|
|
193
|
+
text: `Event handlers in XML views/fragments are either defined in the respective controller ` +
|
|
194
|
+
`(in which case they should be prefixed by a dot, e.g. '.<method name>') or refer to a method of an imported module (via \`core:require\` import)`,
|
|
195
|
+
topics: ["b0fb4de7364f4bcbb053a99aa645affe"],
|
|
196
|
+
},
|
|
197
|
+
"no-deprecated-api": {
|
|
198
|
+
text: `Deprecated UI5 API must not be used. Check the individual API reference for details on how to replace it.`,
|
|
199
|
+
topics: ["28fcd55b04654977b63dacbee0552712"],
|
|
200
|
+
},
|
|
201
|
+
"no-deprecated-component": {
|
|
202
|
+
text: `There must be no dependencies to deprecated components in the project's \`manifest.json\``,
|
|
203
|
+
topics: ["a87ca843bcee469f82a9072927a7dcdb"],
|
|
204
|
+
},
|
|
205
|
+
"no-deprecated-control-renderer-declaration": `The control's renderer has not been declared correctly`,
|
|
206
|
+
"no-deprecated-library": {
|
|
207
|
+
text: `The projects \`manifest.json\` and/or \`ui5.yaml\` declare dependencies to deprecated UI5 framework libraries`,
|
|
208
|
+
topics: ["a87ca843bcee469f82a9072927a7dcdb"],
|
|
209
|
+
},
|
|
210
|
+
"no-deprecated-theme": {
|
|
211
|
+
text: `The project is referencing deprecated UI5 themes`,
|
|
212
|
+
topics: ["a87ca843bcee469f82a9072927a7dcdb"],
|
|
213
|
+
},
|
|
214
|
+
"no-globals": {
|
|
215
|
+
text: `Global variables must not be used for accessing UI5 framework APIs and should be avoided in application code. ` +
|
|
216
|
+
`The respective modules should be imported explicitly.`,
|
|
217
|
+
topics: ["28fcd55b04654977b63dacbee0552712"],
|
|
218
|
+
},
|
|
219
|
+
"no-implicit-globals": {
|
|
220
|
+
text: `Either modules are accessed via the deprecated global library namespace that is exposed by the \`<namespace>/library\` module of a UI5 library,
|
|
221
|
+
or \`odata\` globals are used implicitly in bindings (missing an explicit import of the corresponding module).`,
|
|
222
|
+
topics: ["28fcd55b04654977b63dacbee0552712"],
|
|
223
|
+
},
|
|
224
|
+
"no-pseudo-modules": {
|
|
225
|
+
text: `Deprecated pseudo modules are used`,
|
|
226
|
+
topics: ["00737d6c1b864dc3ab72ef56611491c4"],
|
|
227
|
+
},
|
|
228
|
+
"parsing-error": `During the linting process a syntax or parsing error occured`,
|
|
229
|
+
"prefer-test-starter": {
|
|
230
|
+
text: `Test-related files should be using the Test Starter concept`,
|
|
231
|
+
topics: ["032be2cb2e1d4115af20862673bedcdb"],
|
|
232
|
+
},
|
|
233
|
+
"ui5-class-declaration": `UI5 classes are not declared correctly. This rule only applies to TypeScript code where built-in ECMAScript classes are used instead of an \`.extend()\` call`,
|
|
234
|
+
"unsupported-api-usage": `UI5 API is not used correctly. For example, a formatter declared in a binding declaration in JavaScript is not of type \`function\``,
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=resultContext.js.map
|