worsoft-frontend-codegen-local-mcp 0.1.37 → 0.1.39

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.
Files changed (2) hide show
  1. package/mcp_server.js +8 -11
  2. package/package.json +1 -1
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.37';
8
+ const SERVER_VERSION = '0.1.39';
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');
@@ -154,8 +154,8 @@ const TOOL_SCHEMA = {
154
154
  apiPath: { type: 'string', description: 'Backend API base path from pre-parsed structured metadata, for example iwmEmpOutsourcePerson.' },
155
155
  pageType: {
156
156
  type: 'string',
157
- enum: ['feature', 'dictionary', 'non_standard', 'business', 'dict'],
158
- description: 'Structured page type from parseResult. MCP consumes this value but does not derive it. Dictionary pages are restricted to dialog-based templates.',
157
+ enum: ['business', 'dict', 'non_standard'],
158
+ description: 'Structured page type from parseResult. MCP consumes this value but does not derive it. Dict pages are restricted to dialog-based templates.',
159
159
  },
160
160
  style: { type: 'string', enum: Object.keys(STYLE_CATALOG), description: 'Final style id from parseResult or translated mcpPayload. MCP validates it but does not infer it.' },
161
161
  fields: {
@@ -1253,11 +1253,8 @@ function getStylePreset(styleId) {
1253
1253
  function normalizePageTypeInput(pageType) {
1254
1254
  if (pageType === undefined || pageType === null || pageType === '') return '';
1255
1255
  const normalized = String(pageType).trim();
1256
- if (normalized === 'dict' || normalized === 'business') {
1257
- throw new Error(`Legacy pageType alias "${normalized}" is not allowed. Use canonical pageType "dictionary" or "feature" from parseResult.`);
1258
- }
1259
- if (['feature', 'dictionary', 'non_standard'].includes(normalized)) return normalized;
1260
- throw new Error('Unsupported pageType: ' + normalized);
1256
+ if (['business', 'dict', 'non_standard'].includes(normalized)) return normalized;
1257
+ throw new Error(`Unsupported pageType: ${normalized}. Allowed values are dict, business, non_standard.`);
1261
1258
  }
1262
1259
 
1263
1260
  function rejectSemanticStageInputs(input) {
@@ -1281,9 +1278,9 @@ function validatePageTypeAndStyle(pageType, style) {
1281
1278
  if (pageType === 'non_standard') {
1282
1279
  throw new Error('non_standard pages are not supported by worsoft_codegen_local_generate_frontend');
1283
1280
  }
1284
- if (pageType !== 'dictionary') return;
1281
+ if (pageType !== 'dict') return;
1285
1282
  if (style === 'single_table_jump' || style === 'master_child_jump') {
1286
- throw new Error(`Dictionary pages must use dialog-based styles. pageType=dictionary does not support style=${style}`);
1283
+ throw new Error(`Dict pages must use dialog-based styles. pageType=dict does not support style=${style}`);
1287
1284
  }
1288
1285
  }
1289
1286
 
@@ -1399,7 +1396,7 @@ function buildMultiLevelDictModel(safeArgs) {
1399
1396
  tableName: safeArgs.tableName,
1400
1397
  tableComment: safeArgs.tableComment || parentModule.tableComment,
1401
1398
  apiPath: safeArgs.apiPath || parentModule.apiPath,
1402
- pageType: safeArgs.pageType || 'dictionary',
1399
+ pageType: safeArgs.pageType || 'dict',
1403
1400
  className: toPascalCase(safeArgs.tableName || parentModule.tableName),
1404
1401
  functionName: resolvedTargets.functionName,
1405
1402
  moduleName: resolvedTargets.moduleName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worsoft-frontend-codegen-local-mcp",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Worsoft frontend local-template code generation MCP server.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "worsoft <sw@worsoft.vip>",