Skip to content

Commit 87cb96c

Browse files
engalarclaude
authored andcommitted
feat: migrate all help topics to syntax feature registry (Phase 2)
95 features registered across 7 domain files: domain-model (18), microflow (13), page/snippet/fragment (16), navigation/settings/misc (12), integration/odata/rest/sql/xpath (20), workflow (12), security (8). Legacy topic aliases map old names to new registry paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent eaff441 commit 87cb96c

6 files changed

Lines changed: 1172 additions & 46 deletions

File tree

cmd/mxcli/help.go

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,30 @@ Example:
208208
// Build registry path from args: "workflow user-task" → "workflow.user-task"
209209
path := strings.ToLower(strings.Join(args, "."))
210210

211+
// Map legacy topic aliases to registry paths
212+
topicAliases := map[string]string{
213+
"keywords": "domain-model.keywords",
214+
"reserved": "domain-model.keywords",
215+
"types": "domain-model.types",
216+
"datatypes": "domain-model.types",
217+
"data-types": "domain-model.types",
218+
"delete": "domain-model.association.delete-behavior",
219+
"delete_behavior": "domain-model.association.delete-behavior",
220+
"delete-behavior": "domain-model.association.delete-behavior",
221+
"entity": "domain-model.entity",
222+
"entities": "domain-model.entity",
223+
"enumeration": "domain-model.enumeration",
224+
"enum": "domain-model.enumeration",
225+
"enumerations": "domain-model.enumeration",
226+
"constant": "domain-model.constant",
227+
"constants": "domain-model.constant",
228+
"association": "domain-model.association",
229+
"associations": "domain-model.association",
230+
}
231+
if alias, ok := topicAliases[path]; ok {
232+
path = alias
233+
}
234+
211235
// Check registry first
212236
if syntax.HasPrefix(path) {
213237
features := syntax.ByPrefix(path)
@@ -222,60 +246,14 @@ Example:
222246
// Fall back to legacy topics (first arg only)
223247
topic := strings.ToLower(args[0])
224248
switch topic {
225-
case "keywords", "reserved":
226-
showKeywords()
227-
case "types", "datatypes", "data-types":
228-
showTypes()
229-
case "delete", "delete_behavior", "delete-behavior":
230-
showDeleteBehaviors()
231-
case "entity", "entities":
232-
showTopicHelp("entity")
233-
case "enumeration", "enum", "enumerations":
234-
showTopicHelp("enumeration")
235-
case "constant", "constants":
236-
showTopicHelp("constant")
237-
case "association", "associations":
238-
showTopicHelp("association")
239249
case "microflow", "microflows":
240250
showTopicHelp("microflow")
241251
case "page", "pages":
242252
showTopicHelp("page")
243253
case "snippet", "snippets":
244254
showTopicHelp("snippet")
245-
case "move":
246-
showTopicHelp("move")
247-
case "structure":
248-
showTopicHelp("structure")
249-
case "search":
250-
showTopicHelp("search")
251-
case "odata":
252-
showTopicHelp("odata")
253-
case "rest", "rest-client", "rest-clients":
254-
showTopicHelp("rest")
255-
case "integration", "integrations", "services":
256-
showTopicHelp("integration")
257-
case "contract", "contracts":
258-
showTopicHelp("integration")
259-
case "navigation", "nav":
260-
showTopicHelp("navigation")
261-
case "settings", "project-settings":
262-
showTopicHelp("settings")
263255
case "fragment", "fragments":
264256
showTopicHelp("fragment")
265-
case "java-action", "javaaction", "java_action", "java-actions", "javaactions":
266-
showTopicHelp("java-action")
267-
case "business-events", "businessevents", "business_events", "be":
268-
showTopicHelp("business-events")
269-
case "agents", "agent", "agent-editor", "agenteditor", "model", "models", "knowledge-base", "knowledgebase", "mcp", "mcp-service":
270-
showTopicHelp("agents")
271-
case "xpath", "xpath-constraints":
272-
showTopicHelp("xpath")
273-
case "oql":
274-
showTopicHelp("oql")
275-
case "sql", "external-sql":
276-
showTopicHelp("sql")
277-
case "errors", "validation":
278-
showTopicHelp("errors")
279257
default:
280258
fmt.Printf("Unknown topic: %s\n\n", topic)
281259
cmd.Help()
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
3+
package syntax
4+
5+
func init() {
6+
Register(SyntaxFeature{
7+
Path: "domain-model",
8+
Summary: "Domain model: entities, attributes, associations, enumerations, constants",
9+
Keywords: []string{
10+
"domain model", "entity", "attribute", "association",
11+
"enumeration", "constant", "data model", "schema",
12+
},
13+
Syntax: "CREATE PERSISTENT ENTITY Module.Name (...);\nCREATE ASSOCIATION Module.Name FROM ... TO ...;\nCREATE ENUMERATION Module.Name (...);\nCREATE CONSTANT Module.Name TYPE ... DEFAULT ...;",
14+
Example: "CREATE PERSISTENT ENTITY Shop.Customer (\n Name: String(100) NOT NULL\n);",
15+
SeeAlso: []string{"domain-model.entity", "domain-model.association", "domain-model.enumeration", "domain-model.constant"},
16+
})
17+
18+
// --- Entity ---
19+
20+
Register(SyntaxFeature{
21+
Path: "domain-model.entity",
22+
Summary: "Entity creation: persistent, non-persistent, generalization, event handlers",
23+
Keywords: []string{
24+
"entity", "create entity", "persistent", "non-persistent",
25+
"generalization", "extends", "event handler", "attribute",
26+
},
27+
Syntax: "CREATE PERSISTENT ENTITY Module.Name (\n Attr: Type [constraints],\n ...\n) [INDEX (attr1)] [COMMENT 'text'];\n\nCREATE NON_PERSISTENT ENTITY Module.Name (...);\n\nCREATE PERSISTENT ENTITY Module.Name EXTENDS Module.Parent (...);",
28+
Example: "CREATE PERSISTENT ENTITY MyModule.Customer (\n Name: String(100) NOT NULL ERROR 'Name is required',\n Email: String(200) UNIQUE,\n Balance: Decimal DEFAULT 0,\n IsActive: Boolean DEFAULT true,\n Status: Enumeration(MyModule.CustomerType)\n)\nINDEX (Email)\nCOMMENT 'Stores customer information';",
29+
SeeAlso: []string{"domain-model.entity.create", "domain-model.entity.alter", "domain-model.entity.attributes"},
30+
})
31+
32+
Register(SyntaxFeature{
33+
Path: "domain-model.entity.create",
34+
Summary: "CREATE ENTITY with all options: persistence, generalization, indexes, events",
35+
Keywords: []string{
36+
"create entity", "new entity", "persistent entity",
37+
"non-persistent", "extends", "generalization",
38+
"index", "event handler", "before commit", "after commit",
39+
},
40+
Syntax: "CREATE PERSISTENT ENTITY Module.Name (\n Attr: Type [NOT NULL [ERROR 'msg']] [UNIQUE [ERROR 'msg']] [DEFAULT val],\n ...\n)\n[INDEX (attr1, attr2)]\n[ON BEFORE|AFTER CREATE|COMMIT|DELETE|ROLLBACK CALL Module.MF [RAISE ERROR]]\n[COMMENT 'text'];\n\nCREATE NON_PERSISTENT ENTITY Module.Name (...);\nCREATE PERSISTENT ENTITY Module.Name EXTENDS Module.Parent (...);",
41+
Example: "-- Persistent with constraints and index\nCREATE PERSISTENT ENTITY Shop.Order (\n OrderNumber: String(20) NOT NULL,\n Total: Decimal DEFAULT 0,\n CreatedAt: DateTime\n)\nINDEX (OrderNumber)\nON BEFORE COMMIT CALL Shop.ValidateOrder($currentObject) RAISE ERROR;\n\n-- With generalization\nCREATE PERSISTENT ENTITY Shop.ProductImage EXTENDS System.Image (\n Caption: String(200)\n);",
42+
SeeAlso: []string{"domain-model.entity.alter", "domain-model.entity.attributes"},
43+
})
44+
45+
Register(SyntaxFeature{
46+
Path: "domain-model.entity.alter",
47+
Summary: "ALTER ENTITY: add/rename/modify/drop attributes, indexes, documentation, event handlers",
48+
Keywords: []string{
49+
"alter entity", "modify entity", "add attribute",
50+
"drop attribute", "rename attribute", "add index",
51+
"event handler", "documentation",
52+
},
53+
Syntax: "ALTER ENTITY Module.Name ADD ATTRIBUTE AttrName: Type [constraints];\nALTER ENTITY Module.Name DROP ATTRIBUTE AttrName;\nALTER ENTITY Module.Name RENAME ATTRIBUTE OldName TO NewName;\nALTER ENTITY Module.Name MODIFY ATTRIBUTE AttrName SET DEFAULT val;\nALTER ENTITY Module.Name ADD INDEX (attr1, attr2);\nALTER ENTITY Module.Name SET DOCUMENTATION 'text';\nALTER ENTITY Module.Name ADD EVENT HANDLER ON BEFORE COMMIT CALL Module.MF RAISE ERROR;",
54+
Example: "ALTER ENTITY Shop.Customer ADD ATTRIBUTE Phone: String(20);\nALTER ENTITY Shop.Customer DROP ATTRIBUTE OldField;\nALTER ENTITY Shop.Customer RENAME ATTRIBUTE Email TO EmailAddress;\nALTER ENTITY Shop.Customer ADD INDEX (EmailAddress);\nALTER ENTITY Shop.Customer\n ADD EVENT HANDLER ON BEFORE COMMIT CALL Shop.Validate($currentObject) RAISE ERROR;",
55+
SeeAlso: []string{"domain-model.entity.create", "domain-model.entity.attributes"},
56+
})
57+
58+
Register(SyntaxFeature{
59+
Path: "domain-model.entity.show",
60+
Summary: "List and describe entities in the project",
61+
Keywords: []string{
62+
"show entities", "list entities", "describe entity",
63+
"show attributes", "entity details",
64+
},
65+
Syntax: "SHOW ENTITIES;\nSHOW ENTITIES IN <module>;\nDESCRIBE ENTITY Module.Name;",
66+
Example: "SHOW ENTITIES IN Shop;\nDESCRIBE ENTITY Shop.Customer;",
67+
SeeAlso: []string{"domain-model.entity.create"},
68+
})
69+
70+
Register(SyntaxFeature{
71+
Path: "domain-model.entity.attributes",
72+
Summary: "Attribute data types, constraints, system attributes, and calculated attributes",
73+
Keywords: []string{
74+
"attribute", "data type", "string", "integer", "decimal",
75+
"boolean", "datetime", "autonumber", "binary", "hashedstring",
76+
"not null", "unique", "default", "calculated",
77+
"auto owner", "auto changed by", "system attribute",
78+
},
79+
Syntax: "-- Data types\nString(n) Integer Long Decimal Boolean DateTime Date\nAutoNumber Binary HashedString Enumeration(Module.Name)\n\n-- System attributes (auditing)\nAutoOwner AutoChangedBy AutoCreatedDate AutoChangedDate\n\n-- Constraints\nNOT NULL [ERROR 'msg'] UNIQUE [ERROR 'msg'] DEFAULT value\nCALCULATED BY Module.Microflow",
80+
Example: "CREATE PERSISTENT ENTITY MyModule.AuditedEntity (\n Name: String(100) NOT NULL,\n Age: Integer DEFAULT 0,\n Price: Decimal,\n IsActive: Boolean DEFAULT true,\n Status: Enumeration(MyModule.Status),\n FullName: String(200) CALCULATED BY MyModule.CalcFullName,\n Owner: AutoOwner,\n ChangedBy: AutoChangedBy,\n CreatedDate: AutoCreatedDate,\n ChangedDate: AutoChangedDate\n);",
81+
SeeAlso: []string{"domain-model.entity.create", "domain-model.types"},
82+
})
83+
84+
// --- Association ---
85+
86+
Register(SyntaxFeature{
87+
Path: "domain-model.association",
88+
Summary: "Associations: references between entities (many-to-one, many-to-many)",
89+
Keywords: []string{
90+
"association", "reference", "reference set",
91+
"many-to-one", "many-to-many", "foreign key",
92+
"owner", "delete behavior",
93+
},
94+
Syntax: "CREATE ASSOCIATION Module.Name\n FROM Module.FromEntity TO Module.ToEntity\n TYPE Reference|ReferenceSet\n [OWNER Default|Both]\n [DELETE_BEHAVIOR behavior]\n [COMMENT 'text'];",
95+
Example: "-- Many-to-one\nCREATE ASSOCIATION Shop.Order_Customer\n FROM Shop.Order TO Shop.Customer\n TYPE Reference\n OWNER Default\n DELETE_BEHAVIOR DELETE_BUT_KEEP_REFERENCES;\n\n-- Many-to-many\nCREATE ASSOCIATION Shop.Product_Tag\n FROM Shop.Product TO Shop.Tag\n TYPE ReferenceSet\n OWNER Both;",
96+
SeeAlso: []string{"domain-model.association.create", "domain-model.association.delete-behavior"},
97+
})
98+
99+
Register(SyntaxFeature{
100+
Path: "domain-model.association.create",
101+
Summary: "CREATE ASSOCIATION with type, owner, storage, and delete behavior options",
102+
Keywords: []string{
103+
"create association", "new association", "reference",
104+
"reference set", "junction table", "foreign key",
105+
"owner default", "owner both", "storage column", "storage table",
106+
},
107+
Syntax: "CREATE ASSOCIATION Module.AssociationName\n FROM Module.FromEntity TO Module.ToEntity\n TYPE Reference|ReferenceSet\n [OWNER Default|Both]\n [STORAGE COLUMN|TABLE]\n [DELETE_BEHAVIOR behavior]\n [COMMENT 'text'];\n\nDirection:\n FROM = entity holding the FK (the \"many\" side)\n TO = entity being referenced (the \"one\" side)\n\nTypes:\n Reference = Many-to-one (FK column on FROM table)\n ReferenceSet = Many-to-many (junction table)",
108+
Example: "-- Many-to-one with delete behavior\nCREATE ASSOCIATION Shop.Order_Customer\n FROM Shop.Order TO Shop.Customer\n TYPE Reference\n OWNER Default\n DELETE_BEHAVIOR PREVENT;\n\n-- Many-to-many\nCREATE ASSOCIATION Shop.Product_Tag\n FROM Shop.Product TO Shop.Tag\n TYPE ReferenceSet\n OWNER Both;\n\n-- One-to-one with cascade\nCREATE ASSOCIATION HR.Employee_Profile\n FROM HR.Employee TO HR.EmployeeProfile\n TYPE Reference\n OWNER Default\n DELETE_BEHAVIOR CASCADE;",
109+
SeeAlso: []string{"domain-model.association.delete-behavior", "domain-model.entity.create"},
110+
})
111+
112+
Register(SyntaxFeature{
113+
Path: "domain-model.association.delete-behavior",
114+
Summary: "Delete behavior options for associations",
115+
Keywords: []string{
116+
"delete behavior", "cascade", "prevent",
117+
"delete and references", "delete but keep references",
118+
"delete if no references", "referential integrity",
119+
},
120+
Syntax: "DELETE_BEHAVIOR options:\n DELETE_BUT_KEEP_REFERENCES Delete object, nullify FK (default)\n DELETE_AND_REFERENCES Delete object and cascade to children\n DELETE_IF_NO_REFERENCES Prevent deletion if referenced\n CASCADE Alias for DELETE_AND_REFERENCES\n PREVENT Alias for DELETE_IF_NO_REFERENCES",
121+
Example: "CREATE ASSOCIATION Shop.Order_Customer\n FROM Shop.Order TO Shop.Customer\n TYPE Reference\n DELETE_BEHAVIOR PREVENT;\n\nCREATE ASSOCIATION Shop.Order_Lines\n FROM Shop.OrderLine TO Shop.Order\n TYPE Reference\n DELETE_BEHAVIOR CASCADE;",
122+
SeeAlso: []string{"domain-model.association.create"},
123+
})
124+
125+
// --- Enumeration ---
126+
127+
Register(SyntaxFeature{
128+
Path: "domain-model.enumeration",
129+
Summary: "Enumerations: named sets of values for entity attributes",
130+
Keywords: []string{
131+
"enumeration", "enum", "create enumeration",
132+
"status", "type", "category", "values",
133+
},
134+
Syntax: "CREATE ENUMERATION Module.Name (\n Value1 'Caption 1',\n Value2 'Caption 2',\n ...\n);",
135+
Example: "CREATE ENUMERATION MyModule.OrderStatus (\n Pending 'Pending Approval',\n Processing 'Being Processed',\n Shipped 'Shipped to Customer',\n Delivered 'Delivered',\n Cancelled 'Order Cancelled'\n);",
136+
SeeAlso: []string{"domain-model.enumeration.create", "domain-model.entity.attributes"},
137+
})
138+
139+
Register(SyntaxFeature{
140+
Path: "domain-model.enumeration.create",
141+
Summary: "CREATE ENUMERATION with values and captions, usage in entities",
142+
Keywords: []string{
143+
"create enumeration", "new enum", "enum values",
144+
"caption", "show enumerations", "describe enumeration",
145+
"drop enumeration",
146+
},
147+
Syntax: "CREATE ENUMERATION Module.Name (\n ValueName 'Display Caption',\n ...\n);\n\nSHOW ENUMERATIONS;\nSHOW ENUMERATIONS IN <module>;\nDESCRIBE ENUMERATION Module.Name;\nDROP ENUMERATION Module.Name;\n\nUsing in entity:\n AttrName: Enumeration(Module.EnumName)",
148+
Example: "CREATE ENUMERATION MyModule.OrderStatus (\n Pending 'Pending Approval',\n Processing 'Being Processed',\n Shipped 'Shipped to Customer'\n);\n\n-- Using in an entity\nCREATE PERSISTENT ENTITY MyModule.Order (\n OrderNumber: String(20) NOT NULL,\n Status: Enumeration(MyModule.OrderStatus)\n);",
149+
SeeAlso: []string{"domain-model.enumeration", "domain-model.entity.attributes"},
150+
})
151+
152+
// --- Constant ---
153+
154+
Register(SyntaxFeature{
155+
Path: "domain-model.constant",
156+
Summary: "Constants: named configuration values (String, Integer, Boolean, etc.)",
157+
Keywords: []string{
158+
"constant", "configuration", "config value",
159+
"create constant", "setting",
160+
},
161+
Syntax: "CREATE CONSTANT Module.Name TYPE DataType DEFAULT value [COMMENT 'text'];\nCREATE OR MODIFY CONSTANT Module.Name TYPE DataType DEFAULT value;\n\nSHOW CONSTANTS;\nDESCRIBE CONSTANT Module.Name;\nDROP CONSTANT Module.Name;",
162+
Example: "CREATE CONSTANT MyModule.ApiBaseUrl\n TYPE String\n DEFAULT 'https://api.example.com/v1';\n\nCREATE CONSTANT MyModule.MaxRetries\n TYPE Integer\n DEFAULT 3\n COMMENT 'Maximum API retry attempts';",
163+
SeeAlso: []string{"domain-model.constant.create"},
164+
})
165+
166+
Register(SyntaxFeature{
167+
Path: "domain-model.constant.create",
168+
Summary: "CREATE/DROP/DESCRIBE CONSTANT with supported types and configuration values",
169+
Keywords: []string{
170+
"create constant", "drop constant", "describe constant",
171+
"show constants", "constant values", "modify constant",
172+
"string constant", "integer constant", "boolean constant",
173+
},
174+
Syntax: "CREATE CONSTANT Module.Name\n TYPE String|Integer|Long|Decimal|Boolean|DateTime\n DEFAULT value\n [COMMENT 'description'];\n\nCREATE OR MODIFY CONSTANT Module.Name\n TYPE DataType DEFAULT value [COMMENT 'text'];\n\nSHOW CONSTANTS;\nSHOW CONSTANTS IN <module>;\nSHOW CONSTANT VALUES;\nDESCRIBE CONSTANT Module.Name;\nDROP CONSTANT Module.Name;\n\nRemove override:\n ALTER SETTINGS DROP CONSTANT 'Module.Name' IN CONFIGURATION 'cfg';",
175+
Example: "CREATE CONSTANT MyModule.ApiBaseUrl\n TYPE String\n DEFAULT 'https://api.example.com/v1';\n\nCREATE CONSTANT MyModule.MaxRetries\n TYPE Integer DEFAULT 3\n COMMENT 'Maximum number of API retry attempts';\n\nCREATE CONSTANT MyModule.EnableDebug\n TYPE Boolean DEFAULT false;\n\nCREATE OR MODIFY CONSTANT MyModule.ApiBaseUrl\n TYPE String\n DEFAULT 'https://api.staging.example.com/v2';",
176+
SeeAlso: []string{"domain-model.constant"},
177+
})
178+
179+
// --- Keywords ---
180+
181+
Register(SyntaxFeature{
182+
Path: "domain-model.keywords",
183+
Summary: "Reserved keywords that require quoting when used as identifiers",
184+
Keywords: []string{
185+
"keywords", "reserved words", "identifier",
186+
"quoted identifier", "escape", "backtick", "double quote",
187+
},
188+
Syntax: "Quoted identifier syntax:\n \"ModuleName\".EntityName -- ANSI SQL double quotes\n `ModuleName`.EntityName -- MySQL-style backticks\n \"ModuleName\".\"EntityName\" -- Both parts quoted\n\nMixed quoting is allowed: \"ComboBox\".CategoryTreeVE",
189+
Example: "-- Use quotes when module/entity name conflicts with a keyword\nDESCRIBE ENTITY \"ComboBox\".\"CategoryTreeVE\";\nSHOW ENTITIES IN \"ComboBox\";\nSHOW MICROFLOWS IN `Order`;\n\n-- Common conflicts: ComboBox, DataGrid, Gallery, Title, Status, Type, Value",
190+
})
191+
192+
// --- Types ---
193+
194+
Register(SyntaxFeature{
195+
Path: "domain-model.types",
196+
Summary: "Attribute data types reference: String, Integer, Decimal, Boolean, DateTime, etc.",
197+
Keywords: []string{
198+
"types", "data types", "attribute types",
199+
"string", "integer", "long", "decimal", "boolean",
200+
"datetime", "autonumber", "binary", "hashedstring",
201+
"enumeration type", "currency", "float",
202+
},
203+
Syntax: "String(n) Variable-length text up to n characters\nInteger Whole number (-2B to 2B)\nLong Large whole number\nDecimal Precise decimal for currency/calculations\nBoolean True or false\nDateTime Date and time combined\nDate Date only (no time)\nAutoNumber Auto-incrementing integer\nBinary Binary data (files, images)\nHashedString Securely hashed string (passwords)\nEnumeration(Name) Reference to an enumeration\nAutoOwner System.owner (auto-set on create)\nAutoChangedBy System.changedBy (auto-set on commit)\nAutoCreatedDate DateTime (auto-set on create)\nAutoChangedDate DateTime (auto-set on commit)",
204+
Example: "CREATE PERSISTENT ENTITY MyModule.Customer (\n Name: String(100) NOT NULL,\n Age: Integer,\n Balance: Decimal,\n IsActive: Boolean DEFAULT true,\n CreatedAt: DateTime,\n Status: Enumeration(MyModule.Status)\n);",
205+
SeeAlso: []string{"domain-model.entity.attributes"},
206+
})
207+
}

0 commit comments

Comments
 (0)