worsoft-frontend-codegen-local-mcp
v0.1.94
Published
Worsoft frontend local-template code generation MCP server.
Readme
Worsoft Frontend Codegen Local MCP
This MCP generates Worsoft frontend files from structured JSON metadata.
Scope
- structured JSON input
- style-based template selection
- local template rendering
- single-table runtime generation
- master-child runtime generation with explicit
children[] - single tree runtime generation with
listByParentId - left-tree-right-list runtime generation with explicit
levels[] - optional write-to-disk
Current Inputs
Preferred input:
parseResultPathwriteToDiskoverwritewriteSupportFilesmergeI18nZh
When parseResultPath is provided, MCP reads parseResult.json locally and uses parseResult.mcpPayload as the generation input. The caller should not expand mcpPayload in the model context.
Legacy-compatible low-level inputs:
featureTitletableNametableCommentapiPathstylefieldschildrenlevelsfrontendPathmoduleNamewriteToDiskoverwritewriteSupportFilesmergeI18nZh
frontendPath must point to the frontend project root such as E:/own-worker-platform/trunk/worsoft-ui.
If the caller accidentally passes the src directory, MCP will normalize it back to the project root before rendering files.
Recommended MCP Arguments
Preferred:
{
"parseResultPath": "E:/own-worker-platform/trunk/docs/03-modules/.../parseResult.json",
"writeToDisk": true,
"overwrite": true
}If parseResult.mcpPayload does not contain frontendPath, pass it as a non-semantic runtime argument:
{
"parseResultPath": "E:/own-worker-platform/trunk/docs/03-modules/.../parseResult.json",
"frontendPath": "E:/own-worker-platform/trunk/worsoft-ui",
"writeToDisk": true,
"overwrite": true
}Legacy low-level single table:
{
"featureTitle": "劳务公司管理",
"tableName": "iwm_out_labor_company",
"tableComment": "劳务公司信息表",
"apiPath": "iwmOutLaborCompany",
"style": "single_table_dialog",
"fields": [
{ "fieldName": "id", "label": "主键", "type": "Long", "show": false },
{ "fieldName": "companyName", "label": "劳务公司名称", "type": "String", "required": true, "length": 120 },
{ "fieldName": "status", "label": "状态", "type": "String", "dictType": "labor_company_status", "length": 32 }
],
"children": [],
"frontendPath": "E:/own-worker-platform/trunk/worsoft-ui",
"moduleName": "admin/test",
"writeToDisk": false
}Legacy low-level master-child:
{
"featureTitle": "外包人员登记",
"tableName": "iwm_emp_outsource_person",
"tableComment": "外包人员登记表",
"apiPath": "iwmEmpOutsourcePerson",
"style": "master_child_jump",
"fields": [
{ "fieldName": "id", "label": "主键", "type": "Long", "show": false },
{ "fieldName": "name", "label": "姓名", "type": "String", "required": true, "length": 30 },
{ "fieldName": "employeeStatus", "label": "人员状态", "type": "String", "dictType": "employee_status", "length": 32 }
],
"children": [
{
"childTableName": "iwm_emp_outsource_person_certificate",
"childTableComment": "外包人员证书表",
"payloadField": "certificateList",
"mainField": "id",
"childField": "outsourcePersonId",
"relationType": "1:N",
"fields": [
{ "fieldName": "id", "label": "主键", "type": "Long", "show": false },
{ "fieldName": "certificateId", "label": "证件名称ID", "type": "Long", "required": true }
]
}
],
"frontendPath": "E:/own-worker-platform/trunk/worsoft-ui",
"moduleName": "admin/test",
"writeToDisk": false
}Smoke Test
PowerShell:
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario single
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario single_dialog
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario master
powershell -ExecutionPolicy Bypass -File plugins/worsoft-codegen-local/smoke_test_mcp.ps1 -Scenario multiNode:
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario single
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario parse_result_path
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario single_dialog
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario dict_single
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario master
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario dict_multi
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario single_tree
node plugins/worsoft-codegen-local/smoke_test_mcp.js --scenario tree_left_listOptional overrides:
--table-name--table-comment--feature-title--api-path--style--frontend-path--write-to-disk
Side-Effect Controls
writeSupportFiles=true: MCP may writesrc/enums/dict-registry.tsandsrc/utils/crudSchema.tswriteSupportFiles=false: MCP does not write support files. Generated code still expects those helpers to already exist in the target projectmergeI18nZh=true: MCP reads an existingzh-cn.tsand merges missing keysmergeI18nZh=false: MCP renderszh-cn.tsfrom current metadata only and does not parse the existing file
Legacy Low-Level Master-Child Contract
For low-level master_child_jump calls, MCP does not infer relations. parseResultPath callers should let doc-parse populate parseResult.mcpPayload.children.
The caller must provide explicit children[], and each child must include:
childTableNamechildTableCommentpayloadFieldmainFieldchildFieldfields
If these fields are missing, MCP returns a structured validation error.
Legacy Low-Level Multi-Level Dictionary Contract
For low-level multi_level_dict, MCP does not infer hierarchy. parseResultPath callers should let doc-parse populate parseResult.mcpPayload.levels.
The caller must provide explicit levels[]. Each level must include:
levelIndexmodules
Each module must include:
tableNameapiPathfields
For tree_left_list, level 1 is rendered as the left lazy tree and level 2 is rendered as the right linked list.
The left module may pass treeParentField when the parent field is not parentId.
When the same physical table is split into different logical regions, pass moduleKey to keep the UI state independent.
Current Outputs
src/views/<module>/<function>/index.vuesrc/views/<module>/<function>/form.vuesrc/views/<module>/<function>/options.tssrc/api/<module>/<function>.tssrc/i18n/biz/<module>/<function>.zh-cn.tsmenu/<function>_menu.sql
Style Catalog
- Human guide:
STYLE_TEMPLATE_GUIDE.md - Machine source:
assets/style-catalog.json
Declared styles are defined by assets/style-catalog.json; README intentionally does not duplicate the full enum as a second source.
Notes
- Plugin-local runtime assets live under
assets/templates - MCP does not parse PRD, API, Markdown, or SQL design documents
- Upstream caller-side skills are responsible for turning documents into structured JSON metadata
- Support-file writes and zh-cn merge behavior can be controlled through
writeSupportFilesandmergeI18nZh - Menu SQL is emitted to
frontendPath/menu/
IDE Guide
IDE_MCP_SETUP.md
