worsoft-frontend-codegen-local-mcp 0.1.36 → 0.1.37
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/README.md +3 -0
- package/mcp_server.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,9 @@ This MCP generates Worsoft frontend files from structured JSON metadata.
|
|
|
28
28
|
- `writeSupportFiles`
|
|
29
29
|
- `mergeI18nZh`
|
|
30
30
|
|
|
31
|
+
`frontendPath` must point to the frontend project root such as `E:/own-worker-platform/trunk/worsoft-ui`.
|
|
32
|
+
If the caller accidentally passes the `src` directory, MCP will normalize it back to the project root before rendering files.
|
|
33
|
+
|
|
31
34
|
## Recommended MCP Arguments
|
|
32
35
|
|
|
33
36
|
Single table:
|
package/mcp_server.js
CHANGED
|
@@ -5,7 +5,7 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
|
|
7
7
|
const SERVER_NAME = 'worsoft-codegen-local';
|
|
8
|
-
const SERVER_VERSION = '0.1.
|
|
8
|
+
const SERVER_VERSION = '0.1.37';
|
|
9
9
|
const PROTOCOL_VERSION = '2024-11-05';
|
|
10
10
|
const TOOL_NAME = 'worsoft_codegen_local_generate_frontend';
|
|
11
11
|
const STYLE_CATALOG_PATH = path.join(__dirname, 'assets', 'style-catalog.json');
|
|
@@ -429,6 +429,16 @@ function resolveGenerationTargets({ moduleName, functionName, apiPath, targetVie
|
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
+
function normalizeFrontendRootPath(frontendPath) {
|
|
433
|
+
const resolvedPath = path.resolve(String(frontendPath || ''));
|
|
434
|
+
const normalizedPath = resolvedPath.replace(/[\\/]+$/, '');
|
|
435
|
+
const baseName = path.basename(normalizedPath).toLowerCase();
|
|
436
|
+
if (baseName === 'src') {
|
|
437
|
+
return path.dirname(normalizedPath);
|
|
438
|
+
}
|
|
439
|
+
return normalizedPath;
|
|
440
|
+
}
|
|
441
|
+
|
|
432
442
|
function buildViewRoot(model) {
|
|
433
443
|
return path.join(model.frontendPath, 'src', 'views', ...model.targetViewDir.split('/').filter(Boolean));
|
|
434
444
|
}
|
|
@@ -1396,7 +1406,7 @@ function buildMultiLevelDictModel(safeArgs) {
|
|
|
1396
1406
|
targetViewDir: resolvedTargets.targetViewDir,
|
|
1397
1407
|
targetApiModule: resolvedTargets.targetApiModule,
|
|
1398
1408
|
targetI18nKey: resolvedTargets.targetI18nKey,
|
|
1399
|
-
frontendPath:
|
|
1409
|
+
frontendPath: normalizeFrontendRootPath(safeArgs.frontendPath),
|
|
1400
1410
|
style: safeArgs.style,
|
|
1401
1411
|
levels: builtLevels,
|
|
1402
1412
|
modules: allModules,
|
|
@@ -1497,7 +1507,7 @@ function buildModel(safeArgs) {
|
|
|
1497
1507
|
listFields,
|
|
1498
1508
|
gridFields,
|
|
1499
1509
|
dictTypes,
|
|
1500
|
-
frontendPath:
|
|
1510
|
+
frontendPath: normalizeFrontendRootPath(safeArgs.frontendPath),
|
|
1501
1511
|
style: safeArgs.style,
|
|
1502
1512
|
children,
|
|
1503
1513
|
};
|
package/package.json
CHANGED