scaffold-engine 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.
Files changed (52) hide show
  1. package/README.md +117 -0
  2. package/engine.project.example.json +23 -0
  3. package/package.json +49 -0
  4. package/scripts/postinstall.cjs +42 -0
  5. package/specs/catalogs/action-templates.yaml +189 -0
  6. package/specs/catalogs/child-templates.yaml +54 -0
  7. package/specs/catalogs/field-fragments.yaml +203 -0
  8. package/specs/catalogs/object-catalog.yaml +35 -0
  9. package/specs/catalogs/object-name-suggestions.yaml +30 -0
  10. package/specs/catalogs/object-templates.yaml +45 -0
  11. package/specs/catalogs/pattern-catalog.yaml +48 -0
  12. package/specs/catalogs/status-templates.yaml +16 -0
  13. package/specs/projects/crm-pilot/customer.yaml +122 -0
  14. package/specs/projects/crm-pilot/lead.from-nl.yaml +76 -0
  15. package/specs/projects/crm-pilot/lead.yaml +82 -0
  16. package/specs/projects/generated-from-nl/crm-customer.yaml +158 -0
  17. package/specs/projects/generated-from-nl/crm-lead.yaml +76 -0
  18. package/specs/projects/generated-from-nl/crm-opportunity.yaml +78 -0
  19. package/specs/projects/generated-from-nl/crm-quote.yaml +78 -0
  20. package/specs/projects/generated-from-nl/custom-documentLines.yaml +125 -0
  21. package/specs/projects/generated-from-nl/custom-treeEntity.yaml +78 -0
  22. package/specs/projects/generated-from-nl/erp-material-pattern-test.yaml +79 -0
  23. package/specs/projects/generated-from-nl/erp-material.yaml +78 -0
  24. package/specs/projects/generated-from-nl/hr-orgUnit.yaml +100 -0
  25. package/specs/projects/pattern-examples/document-lines-demo.yaml +125 -0
  26. package/specs/projects/pattern-examples/tree-entity-demo.yaml +79 -0
  27. package/specs/rules/business-model.schema.json +262 -0
  28. package/specs/rules/extension-boundaries.json +26 -0
  29. package/specs/rules/requirement-draft.schema.json +75 -0
  30. package/specs/rules/spec-governance.json +29 -0
  31. package/specs/templates/crm/customer.template.yaml +121 -0
  32. package/specs/templates/crm/lead.template.yaml +82 -0
  33. package/tools/analyze-requirement.cjs +950 -0
  34. package/tools/cli.cjs +59 -0
  35. package/tools/create-draft.cjs +18 -0
  36. package/tools/engine.cjs +47 -0
  37. package/tools/generate-draft.cjs +33 -0
  38. package/tools/generate-module.cjs +1218 -0
  39. package/tools/init-project.cjs +194 -0
  40. package/tools/lib/draft-toolkit.cjs +357 -0
  41. package/tools/lib/model-toolkit.cjs +482 -0
  42. package/tools/lib/pattern-renderers.cjs +166 -0
  43. package/tools/lib/renderers/detail-page-renderer.cjs +327 -0
  44. package/tools/lib/renderers/form-page-renderer.cjs +553 -0
  45. package/tools/lib/renderers/list-page-renderer.cjs +371 -0
  46. package/tools/lib/runtime-config.cjs +154 -0
  47. package/tools/patch-draft.cjs +57 -0
  48. package/tools/prompts/business-model-prompt.md +58 -0
  49. package/tools/run-requirement.cjs +672 -0
  50. package/tools/validate-draft.cjs +32 -0
  51. package/tools/validate-model.cjs +140 -0
  52. package/tools/verify-patterns.cjs +67 -0
@@ -0,0 +1,121 @@
1
+ meta:
2
+ domain: crm
3
+ object: customer
4
+ label: 客户
5
+ version: 0.1.0
6
+ description: >
7
+ CRM 客户主数据对象模板。用于验证主模型、联系人子表、基础动作与列表/表单/详情视图的生成闭环。
8
+
9
+ data:
10
+ table: crm_customer
11
+ fields:
12
+ - name: customerCode
13
+ label: 客户编码
14
+ type: string
15
+ required: true
16
+ unique: true
17
+ - name: customerName
18
+ label: 客户名称
19
+ type: string
20
+ required: true
21
+ - name: level
22
+ label: 客户等级
23
+ type: enum
24
+ options: [A, B, C]
25
+ default: B
26
+ - name: status
27
+ label: 状态
28
+ type: enum
29
+ options: [draft, active, inactive]
30
+ default: draft
31
+ - name: ownerName
32
+ label: 客户负责人
33
+ type: string
34
+ - name: source
35
+ label: 客户来源
36
+ type: enum
37
+ options: [manual, import, campaign]
38
+ default: manual
39
+ children:
40
+ - name: contacts
41
+ label: 联系人
42
+ table: crm_customer_contact
43
+ foreignKey: customerId
44
+ fields:
45
+ - name: contactName
46
+ label: 联系人姓名
47
+ type: string
48
+ required: true
49
+ - name: mobile
50
+ label: 手机号
51
+ type: string
52
+ - name: email
53
+ label: 邮箱
54
+ type: string
55
+ - name: isPrimary
56
+ label: 是否主联系人
57
+ type: boolean
58
+ default: false
59
+
60
+ app:
61
+ actions: [create, update, detail, list, activate, deactivate]
62
+ defaultStatus: draft
63
+ responseContract:
64
+ envelope: standard
65
+ listSchema: pagedList
66
+ detailSchema: object
67
+ mutationSchema: object
68
+ permissionProfile:
69
+ mode: inherit
70
+ resourceScope: object
71
+ actionPolicies:
72
+ - action: create
73
+ permission: create
74
+ - action: update
75
+ permission: update
76
+ - action: list
77
+ permission: list
78
+ - action: detail
79
+ permission: detail
80
+ - action: activate
81
+ permission: activate
82
+ - action: deactivate
83
+ permission: deactivate
84
+ statusFlow:
85
+ enabled: true
86
+ states: [draft, active, inactive]
87
+ transitions:
88
+ - action: activate
89
+ from: [draft, inactive]
90
+ to: active
91
+ - action: deactivate
92
+ from: [active]
93
+ to: inactive
94
+ validationRules:
95
+ - name: statusTransition
96
+ scope: workflow
97
+ rule: statusTransition
98
+ fields: [status]
99
+ message: 状态流转必须符合既定规则
100
+ errorCodes:
101
+ - code: VALIDATION_FAILED
102
+ message: 输入校验失败
103
+ - code: RECORD_NOT_FOUND
104
+ message: 客户不存在
105
+ - code: DUPLICATE_KEY
106
+ message: 客户编码已存在
107
+ - code: INVALID_STATUS_TRANSITION
108
+ message: 当前状态不允许执行该动作
109
+
110
+ ui:
111
+ list:
112
+ columns: [customerCode, customerName, level, status, ownerName, createdAt]
113
+ filters: [customerCode, customerName, status]
114
+ form:
115
+ groups:
116
+ - title: 基本信息
117
+ fields: [customerCode, customerName, level, status, ownerName, source]
118
+ - title: 联系人
119
+ childTable: contacts
120
+ detail:
121
+ sections: [basicInfo, contacts]
@@ -0,0 +1,82 @@
1
+ meta:
2
+ domain: crm
3
+ object: lead
4
+ label: 线索
5
+ version: 0.1.0
6
+ description: >
7
+ CRM 线索对象模板。用于验证主对象字段、基础动作与列表/表单/详情视图
8
+ 在当前生成链路中的最小闭环。
9
+
10
+ data:
11
+ table: crm_lead
12
+ fields:
13
+ - name: leadCode
14
+ label: 线索编号
15
+ type: string
16
+ required: true
17
+ unique: true
18
+ - name: leadName
19
+ label: 线索名称
20
+ type: string
21
+ required: true
22
+ - name: source
23
+ label: 线索来源
24
+ type: enum
25
+ options: [website, referral, campaign, manual]
26
+ default: manual
27
+ - name: ownerName
28
+ label: 负责人
29
+ type: string
30
+ - name: phone
31
+ label: 联系电话
32
+ type: string
33
+ - name: status
34
+ label: 状态
35
+ type: enum
36
+ options: [draft, following, converted, closed]
37
+ default: draft
38
+
39
+ app:
40
+ actions: [create, update, detail, list]
41
+ defaultStatus: draft
42
+ responseContract:
43
+ envelope: standard
44
+ listSchema: pagedList
45
+ detailSchema: object
46
+ mutationSchema: object
47
+ permissionProfile:
48
+ mode: inherit
49
+ resourceScope: object
50
+ actionPolicies:
51
+ - action: create
52
+ permission: create
53
+ - action: update
54
+ permission: update
55
+ - action: list
56
+ permission: list
57
+ - action: detail
58
+ permission: detail
59
+ validationRules:
60
+ - name: uniqueLeadCode
61
+ scope: service
62
+ rule: unique
63
+ fields: [leadCode]
64
+ message: 线索编号必须唯一
65
+ errorCodes:
66
+ - code: VALIDATION_FAILED
67
+ message: 输入校验失败
68
+ - code: RECORD_NOT_FOUND
69
+ message: 线索不存在
70
+ - code: DUPLICATE_KEY
71
+ message: 线索编号已存在
72
+
73
+ ui:
74
+ list:
75
+ columns: [leadCode, leadName, source, ownerName, status, createdAt]
76
+ filters: [leadCode, leadName, source, status]
77
+ form:
78
+ groups:
79
+ - title: 基本信息
80
+ fields: [leadCode, leadName, source, ownerName, phone, status]
81
+ detail:
82
+ sections: [basicInfo]