### Setup mxbuild and then check project Source: https://www.mxcli.org/tools/docker-check.html If mxbuild is not installed locally, use `mxcli setup mxbuild` to download it first, then run the check command. The downloaded mxbuild is cached for reuse. ```bash # Explicit setup (downloads matching mxbuild version) mxcli setup mxbuild -p app.mpr # Then check mxcli docker check -p app.mpr ``` -------------------------------- ### MX-CLI Setup for Fluent API Source: https://www.mxcli.org/library/fluent-examples.html This is the common setup required for all fluent API examples. It opens an Mendix project for writing and initializes the model API. ```go package main import ( "log" "github.com/mendixlabs/mxcli/api" "github.com/mendixlabs/mxcli/sdk/mpr" ) func main() { writer, err := mpr.OpenForWriting("/path/to/MyApp.mpr") if err != nil { log.Fatal(err) } defer writer.Close() modelAPI := api.New(writer) module, _ := modelAPI.Modules.GetModule("Sales") modelAPI.SetModule(module) // ... examples below } ``` -------------------------------- ### Server Configuration Examples Source: https://www.mxcli.org/language/project-settings.html Examples of setting server configurations for DatabaseType, DatabaseUrl, and HttpPortNumber. ```mdl ALTER SETTINGS CONFIGURATION 'default' DatabaseType = 'POSTGRESQL'; ALTER SETTINGS CONFIGURATION 'default' DatabaseUrl = 'jdbc:postgresql://localhost:5432/myapp'; ALTER SETTINGS CONFIGURATION 'default' HttpPortNumber = '8080'; ``` -------------------------------- ### Install mxcli Library with Go Source: https://www.mxcli.org/library/installation.html Use this command to install the mxcli library. Ensure you have Go 1.21+ installed. No CGO is required. ```go go get github.com/mendixlabs/mxcli ``` -------------------------------- ### Sequential test case execution with setup and validation Source: https://www.mxcli.org/tools/test-annotations.html This example demonstrates sequential test case execution, where earlier tests set up state for later ones. It includes creating modules, enumerations, entities, microflows, and granting security access, with expected outcomes for each step. ```mdl __ -- @test Setup: Create module and enumeration CREATE MODULE TestSales; CREATE ENUMERATION TestSales.OrderStatus ( Draft 'Draft', Submitted 'Submitted', Completed 'Completed' ); -- @expect 0 errors ``` ```mdl __ -- @test Create entity with enum attribute CREATE PERSISTENT ENTITY TestSales.Order ( OrderNumber: String(50) NOT NULL, Status: Enumeration(TestSales.OrderStatus) DEFAULT 'Draft', TotalAmount: Decimal DEFAULT 0 ); -- @expect 0 errors ``` ```mdl __ -- @test Create microflow with validation CREATE MICROFLOW TestSales.ACT_SubmitOrder( $order: TestSales.Order ) RETURNS Boolean AS $success BEGIN DECLARE $success Boolean = false; IF $order/TotalAmount <= 0 THEN VALIDATION FEEDBACK $order/TotalAmount MESSAGE 'Total must be positive'; RETURN false; END IF; CHANGE $order (Status = 'Submitted'); COMMIT $order; SET $success = true; RETURN $success; END; -- @expect 0 errors ``` ```mdl __ -- @test Security: grant access CREATE MODULE ROLE TestSales.User; GRANT EXECUTE ON MICROFLOW TestSales.ACT_SubmitOrder TO TestSales.User; GRANT TestSales.User ON TestSales.Order (CREATE, DELETE, READ *, WRITE *); -- @expect 0 errors ``` -------------------------------- ### Create Page Example Source: https://www.mxcli.org/appendixes/quick-reference.html Example of creating a new page with parameters, title, layout, and widgets. ```MX-CLI CREATE PAGE MyModule.Customer_Edit ( Params: { $Customer: MyModule.Customer }, Title: 'Edit Customer', Layout: Atlas_Core.PopupLayout ) { DATAVIEW dvCustomer (DataSource: $Customer) { TEXTBOX txtName (Label: 'Name', Attribute: Name) TEXTBOX txtEmail (Label: 'Email', Attribute: Email) COMBOBOX cbStatus (Label: 'Status', Attribute: Status) FOOTER footer1 { ACTIONBUTTON btnSave (Caption: 'Save', Action: SAVE_CHANGES, ButtonStyle: Primary) ACTIONBUTTON btnCancel (Caption: 'Cancel', Action: CANCEL_CHANGES) } } } ``` -------------------------------- ### Install mxcli from Source Source: https://www.mxcli.org/tutorial/quickstart.html Install the mxcli tool using Go's package management. ```bash go install github.com/mendixlabs/mxcli/cmd/mxcli@latest ``` -------------------------------- ### Running the Read Project Example Source: https://www.mxcli.org/library/reading.html Instructions on how to run the example code for reading a Mendix project from the command line. ```bash cd examples/read_project go run main.go /path/to/MyApp.mpr ``` -------------------------------- ### OData Client Example Source: https://www.mxcli.org/appendixes/quick-reference.html Example of creating an OData client with specified configuration. ```APIDOC ## CREATE ODATA CLIENT Example ### Description This example demonstrates how to create an OData client named `MyModule.ExternalAPI`. ### Syntax ``` CREATE ODATA CLIENT MyModule.ExternalAPI ( Version: '1.0', ODataVersion: OData4, MetadataUrl: 'https://api.example.com/odata/v4/$metadata', Timeout: 300 ); ``` ``` -------------------------------- ### Example: Create Knowledge Base Source: https://www.mxcli.org/reference/agent/create-knowledge-base.html Example of creating a knowledge base named 'ProductDocs' in 'MyModule', using a string constant 'KBKey' for the key. ```APIDOC ## Example: Create Knowledge Base ### Request Example ``` CREATE CONSTANT MyModule."KBKey" TYPE String DEFAULT ''; / CREATE KNOWLEDGE BASE MyModule."ProductDocs" ( Provider: MxCloudGenAI, key: MyModule.KBKey ); / ``` ``` -------------------------------- ### Create Knowledge Base Example Source: https://www.mxcli.org/reference/agent/create-knowledge-base.html This example demonstrates how to create a new knowledge base named 'ProductDocs' within the 'MyModule' module. It first defines a string constant 'KBKey' to hold the resource key. ```mxcli CREATE CONSTANT MyModule."KBKey" TYPE String DEFAULT ''; / CREATE KNOWLEDGE BASE MyModule."ProductDocs" ( Provider: MxCloudGenAI, key: MyModule.KBKey ); / ``` -------------------------------- ### Full Example: Model Creation Source: https://www.mxcli.org/library/fluent-api.html A comprehensive example combining initialization, entity creation, association, enumeration, and microflow creation. ```APIDOC ## Full Example: Model Creation This complete example demonstrates initializing the API, creating entities, an association, an enumeration, and a microflow. ```go package main import ( "github.com/mendixlabs/mxcli/api" "github.com/mendixlabs/mxcli/sdk/mpr" ) func main() { writer, err := mpr.OpenForWriting("/path/to/MyApp.mpr") if err != nil { panic(err) } defer writer.Close() modelAPI := api.New(writer) module, _ := modelAPI.Modules.GetModule("MyModule") modelAPI.SetModule(module) // Create entity with fluent builder customer, _ := modelAPI.DomainModels.CreateEntity("Customer"). Persistent(). WithStringAttribute("Name", 100). WithStringAttribute("Email", 254). WithIntegerAttribute("Age"). WithBooleanAttribute("IsActive"). WithDateTimeAttribute("CreatedDate", true). Build() // Create another entity order, _ := modelAPI.DomainModels.CreateEntity("Order"). Persistent(). WithDecimalAttribute("TotalAmount"). WithDateTimeAttribute("OrderDate", true). Build() // Create association between entities _, _ = modelAPI.DomainModels.CreateAssociation("Customer_Orders"). From("Customer"). To("Order"). OneToMany(). Build() // Create enumeration _, _ = modelAPI.Enumerations.CreateEnumeration("OrderStatus"). WithValue("Pending", "Pending"). WithValue("Processing", "Processing"). WithValue("Completed", "Completed"). WithValue("Cancelled", "Cancelled"). Build() // Create microflow _, _ = modelAPI.Microflows.CreateMicroflow("ACT_ProcessOrder"). WithParameter("Order", "MyModule.Order"). WithStringParameter("Message"). ReturnsBoolean(). Build() } ``` ``` -------------------------------- ### Create Workflow Example Source: https://www.mxcli.org/appendixes/quick-reference.html An example demonstrating the creation of a workflow with a user task, including parameters and outcomes. ```mxcli CREATE WORKFLOW Module.ApprovalFlow PARAMETER $Context: Module.Request OVERVIEW PAGE Module.WorkflowOverview BEGIN USER TASK ReviewTask 'Review the request' PAGE Module.ReviewPage OUTCOMES 'Approve' { } 'Reject' { }; END WORKFLOW; ``` -------------------------------- ### Workflow Settings Examples Source: https://www.mxcli.org/language/project-settings.html Examples of configuring workflow settings, including UserEntity and DefaultTaskParallelism. ```mdl ALTER SETTINGS WORKFLOWS UserEntity = 'Administration.Account'; ALTER SETTINGS WORKFLOWS DefaultTaskParallelism = '5'; ``` -------------------------------- ### Complete Import Workflow Example Source: https://www.mxcli.org/tools/import-from.html A comprehensive example showing the connection to an external database, previewing data, importing with mapping, importing with association linking, and finally disconnecting. ```mxcli -- Connect to external source SQL CONNECT postgres 'postgres://user:pass@legacy-db:5432/hrdb' AS legacy; -- Preview the data SQL legacy SELECT name, email, department FROM employees LIMIT 5; -- Import employees IMPORT FROM legacy QUERY 'SELECT name, email FROM employees WHERE active = true' INTO HR.Employee MAP (name AS FullName, email AS EmailAddress) BATCH 500; -- Import with association linking IMPORT FROM legacy QUERY 'SELECT name, dept_name FROM employees WHERE active = true' INTO HR.Employee MAP (name AS FullName) LINK (dept_name TO Employee_Department ON DepartmentName) BATCH 500 LIMIT 10000; -- Disconnect SQL DISCONNECT legacy; ``` -------------------------------- ### Runtime Settings Examples Source: https://www.mxcli.org/language/project-settings.html Examples of modifying runtime settings, including AfterStartupMicroflow, HashAlgorithm, and JavaVersion. ```mdl ALTER SETTINGS MODEL AfterStartupMicroflow = 'MyModule.ACT_Startup'; ALTER SETTINGS MODEL HashAlgorithm = 'BCrypt'; ALTER SETTINGS MODEL JavaVersion = '17'; ``` -------------------------------- ### Example Usage Source: https://www.mxcli.org/library/writer-methods.html A comprehensive example demonstrating how to use the writer methods and helper functions to modify a project. ```APIDOC ## Example Usage ```go writer, _ := modelsdk.OpenForWriting("/path/to/MyApp.mpr") deferr writer.Close() reader := writer.Reader() modules, _ := reader.ListModules() dm, _ := reader.GetDomainModel(modules[0].ID) // Create entity customer := modelsdk.NewEntity("Customer") customer.Documentation = "Customer master data" customer.Location = model.Point{X: 100, Y: 200} writer.CreateEntity(dm.ID, customer) // Add attributes writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewStringAttribute("Name", 200)) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewStringAttribute("Email", 254)) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewBooleanAttribute("IsActive")) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewDateTimeAttribute("CreatedDate", true)) // Create association order := modelsdk.NewEntity("Order") writer.CreateEntity(dm.ID, order) assoc := modelsdk.NewAssociation("Customer_Order", customer.ID, order.ID) writer.CreateAssociation(dm.ID, assoc) ``` > **Warning:** Always back up your `.mpr` file before modifying it. The writer operates directly on the SQLite database. ``` -------------------------------- ### Full Workflow Example Source: https://www.mxcli.org/reference/external-sql/sql-generate-connector.html This example demonstrates a complete workflow: connecting to a PostgreSQL database, showing tables, describing a specific table, generating and executing a connector module for specific tables, and finally disconnecting. ```sql SQL CONNECT postgres 'postgres://user:pass@localhost:5432/hrdb' AS source; SQL source SHOW TABLES; SQL source DESCRIBE employees; SQL source GENERATE CONNECTOR INTO HRModule TABLES (employees, departments) EXEC; SQL DISCONNECT source; ``` -------------------------------- ### Show Callees Examples Source: https://www.mxcli.org/tools/callers-callees.html Examples showing how to find what a microflow calls or what entities it uses. ```mxm -- Find what a microflow calls SHOW CALLEES OF Sales.ACT_ProcessOrder; ``` ```mxm -- Find what entities a microflow uses SHOW CALLEES OF Sales.SubmitOrder; ``` -------------------------------- ### Full Project Inspection Example Source: https://www.mxcli.org/library/reading.html A comprehensive example demonstrating how to open a Mendix project and list its modules, entities, attributes, microflows, and pages. ```go package main import ( "fmt" "github.com/mendixlabs/mxcli" ) func main() { // Open a Mendix project reader, err := modelsdk.Open("/path/to/MyApp.mpr") if err != nil { panic(err) } defer reader.Close() // List all modules modules, _ := reader.ListModules() for _, m := range modules { fmt.Printf("Module: %s\n", m.Name) } // Get domain model for a module dm, _ := reader.GetDomainModel(modules[0].ID) for _, entity := range dm.Entities { fmt.Printf(" Entity: %s\n", entity.Name) for _, attr := range entity.Attributes { fmt.Printf(" - %s: %s\n", attr.Name, attr.Type.GetTypeName()) } } // List microflows microflows, _ := reader.ListMicroflows() fmt.Printf("Total microflows: %d\n", len(microflows)) // List pages pages, _ := reader.ListPages() fmt.Printf("Total pages: %d\n", len(pages)) } ``` -------------------------------- ### Show Callers Examples Source: https://www.mxcli.org/tools/callers-callees.html Examples demonstrating how to find callers for microflows, entities, and pages. ```mxm -- Find everything that calls a microflow SHOW CALLERS OF Sales.ACT_ProcessOrder; ``` ```mxm -- Find what references an entity SHOW CALLERS OF Sales.Customer; ``` ```mxm -- Find what uses a page SHOW CALLERS OF Sales.CustomerOverview; ``` -------------------------------- ### Example: Create or Modify Knowledge Base Source: https://www.mxcli.org/reference/agent/create-knowledge-base.html Example of creating or modifying a knowledge base named 'ProductDocs' in 'MyModule', using a string constant 'KBKey' for the key. ```APIDOC ## Example: Create or Modify Knowledge Base ### Request Example ``` CREATE OR MODIFY KNOWLEDGE BASE MyModule."ProductDocs" ( Provider: MxCloudGenAI, key: MyModule.KBKey ); / ``` ``` -------------------------------- ### Navigation Example Source: https://www.mxcli.org/appendixes/quick-reference.html An example demonstrating the creation or replacement of a navigation profile, defining home pages, login page, 404 page, and a menu structure. ```mxcli CREATE OR REPLACE NAVIGATION Responsive HOME PAGE MyModule.Home_Web HOME PAGE MyModule.AdminHome FOR MyModule.Administrator LOGIN PAGE Administration.Login NOT FOUND PAGE MyModule.Custom404 MENU ( MENU ITEM 'Home' PAGE MyModule.Home_Web; MENU 'Admin' ( MENU ITEM 'Users' PAGE Administration.Account_Overview; ); ); ``` -------------------------------- ### Comprehensive Import Example Source: https://www.mxcli.org/tools/import-from.html A complete example showcasing the use of SQL CONNECT, IMPORT with mapping, batching, and association linking, followed by SQL DISCONNECT. ```APIDOC ## Example Usage of IMPORT Command ### Description This example illustrates a full workflow: connecting to an external PostgreSQL database, performing a preview query, importing employee data with column mapping and batching, importing employee data with association linking, batching, and row limiting, and finally disconnecting from the external source. ### Method SQL CONNECT, SQL SELECT, IMPORT, SQL DISCONNECT ### Endpoint N/A (CLI commands) ### Parameters See individual command descriptions for `SQL CONNECT`, `SQL SELECT`, `IMPORT`, and `SQL DISCONNECT`. ### Request Example ``` -- Connect to external source SQL CONNECT postgres 'postgres://user:pass@legacy-db:5432/hrdb' AS legacy; -- Preview the data SQL legacy SELECT name, email, department FROM employees LIMIT 5; -- Import employees with column mapping and batching IMPORT FROM legacy QUERY 'SELECT name, email FROM employees WHERE active = true' INTO HR.Employee MAP (name AS FullName, email AS EmailAddress) BATCH 500; -- Import employees with association linking, batching, and row limiting IMPORT FROM legacy QUERY 'SELECT name, dept_name FROM employees WHERE active = true' INTO HR.Employee MAP (name AS FullName) LINK (dept_name TO Employee_Department ON DepartmentName) BATCH 500 LIMIT 10000; -- Disconnect from external source SQL DISCONNECT legacy; ``` ### Response N/A (CLI command output) ### Success Response (200) N/A ### Response Example N/A ``` -------------------------------- ### Create or Modify Knowledge Base Example Source: https://www.mxcli.org/reference/agent/create-knowledge-base.html This example shows how to create or modify an existing knowledge base. If 'ProductDocs' already exists, its properties will be updated in place, preserving the document UUID. ```mxcli CREATE OR MODIFY KNOWLEDGE BASE MyModule."ProductDocs" ( Provider: MxCloudGenAI, key: MyModule.KBKey ); / ``` -------------------------------- ### Example Workflow Definition Source: https://www.mxcli.org/language/workflow-structure.html An example demonstrating a workflow for onboarding an employee, including parallel tasks, a decision point for manager approval, and microflow calls. ```workflow __ CREATE WORKFLOW HR.OnboardEmployee PARAMETER $Context: HR.OnboardingRequest OVERVIEW PAGE HR.OnboardingOverview BEGIN -- Parallel: IT setup and HR paperwork happen simultaneously PARALLEL SPLIT PATH 1 { USER TASK SetupLaptop 'Set up laptop and accounts' PAGE HR.IT_SetupPage OUTCOMES 'Done' { }; } PATH 2 { USER TASK SignDocuments 'Sign employment documents' PAGE HR.DocumentSignPage OUTCOMES 'Signed' { }; }; -- After both paths complete, manager reviews DECISION 'Manager approval required?' OUTCOMES 'Yes' { USER TASK ManagerReview 'Review onboarding' PAGE HR.ManagerReviewPage OUTCOMES 'Approve' { } 'Reject' { CALL MICROFLOW HR.ACT_RejectOnboarding; END; }; } 'No' { }; CALL MICROFLOW HR.ACT_CompleteOnboarding; END WORKFLOW; ``` -------------------------------- ### Example: Responsive Web Navigation Profile Source: https://www.mxcli.org/language/navigation-profiles.html This example demonstrates a complete navigation profile for a responsive web interface. It includes a default home page, an administrator-specific home page, a login page, a custom 404 page, and a complex menu structure with submenus. ```mdl __ CREATE OR REPLACE NAVIGATION Responsive HOME PAGE MyModule.Home_Web HOME PAGE MyModule.AdminHome FOR MyModule.Administrator LOGIN PAGE Administration.Login NOT FOUND PAGE MyModule.Custom404 MENU ( MENU ITEM 'Home' PAGE MyModule.Home_Web; MENU ITEM 'Orders' PAGE Shop.Order_Overview; MENU 'Administration' ( MENU ITEM 'Users' PAGE Administration.Account_Overview; MENU ITEM 'Settings' PAGE MyModule.Settings; ); ); ``` -------------------------------- ### mxcli Command Examples Source: https://www.mxcli.org/tutorial/show-structure.html Examples of using the mxcli command with the SHOW STRUCTURE option for various project overview needs. ```bash __ # Quick project overview mxcli -p app.mpr -c "SHOW STRUCTURE DEPTH 1" # Detailed view of one module mxcli -p app.mpr -c "SHOW STRUCTURE DEPTH 3 IN Sales" # Full project including system modules mxcli -p app.mpr -c "SHOW STRUCTURE ALL" ``` -------------------------------- ### Full Navigation Menu Structure Example Source: https://www.mxcli.org/language/home-pages.html An example demonstrating a complete navigation menu with nested submenus, including home page and login page assignments. ```mxnavi CREATE OR REPLACE NAVIGATION Responsive HOME PAGE Shop.Home LOGIN PAGE Administration.Login MENU ( MENU ITEM 'Home' PAGE Shop.Home; MENU ITEM 'Products' PAGE Shop.Product_Overview; MENU ITEM 'Orders' PAGE Shop.Order_Overview; MENU 'Administration' ( MENU ITEM 'Users' PAGE Administration.Account_Overview; MENU ITEM 'Roles' PAGE Administration.Role_Overview; MENU 'System' ( MENU ITEM 'Logs' PAGE Administration.Log_Overview; MENU ITEM 'Settings' PAGE Shop.Settings; ); ); ); ``` -------------------------------- ### Example: Drop Image Collection and Show References Source: https://www.mxcli.org/reference/image-collection/drop-image-collection.html This example first shows references to 'AppIcons' within 'MyModule' and then proceeds to drop the 'AppIcons' image collection. This is useful for understanding dependencies before removal. ```mxcli SHOW REFERENCES TO MyModule.AppIcons; DROP IMAGE COLLECTION MyModule.AppIcons; ``` -------------------------------- ### AutoNumber Attribute Examples Source: https://www.mxcli.org/language/primitive-types.html Examples of using AutoNumber for unique identifiers, often combined with NOT NULL and UNIQUE constraints. The default value specifies the starting number. ```mdl OrderId: AutoNumber NOT NULL UNIQUE DEFAULT 1 CustomerId: AutoNumber ``` -------------------------------- ### Running the Project Modification Example Source: https://www.mxcli.org/library/modifying.html Command to execute the project modification example. Ensure you are in the 'examples/modify_project' directory and provide the path to your Mendix project file. ```bash __ cd examples/modify_project go run main.go /path/to/MyApp.mpr ``` -------------------------------- ### Complete Microflow Example Source: https://www.mxcli.org/language/microflow-structure.html A comprehensive example demonstrating microflow creation, parameter usage, local variables, activity calls, conditional logic, and return values. ```mdl CREATE MICROFLOW Sales.ACT_ProcessOrder FOLDER 'Orders/Processing' BEGIN -- Parameters DECLARE $Order Sales.Order; DECLARE $ApplyDiscount Boolean; -- Local variable DECLARE $Total Decimal = 0; -- Retrieve order lines RETRIEVE $Lines FROM $Order/Sales.OrderLine_Order; -- Calculate total @caption 'Calculate total' $Total = CALL MICROFLOW Sales.SUB_CalculateTotal ( OrderLines = $Lines ); -- Apply discount if requested IF $ApplyDiscount THEN SET $Total = $Total * 0.9; END IF; -- Update order CHANGE $Order ( TotalAmount = $Total, Status = 'Processed' ); COMMIT $Order; RETURN $Order; END; ``` -------------------------------- ### Configure Project Security and Create Demo Users Source: https://www.mxcli.org/language/demo-users.html This example shows how to set the project security level to prototype, enable demo users, and then create multiple demo accounts for different roles. ```sql __ -- Enable demo users and set prototype security ALTER PROJECT SECURITY LEVEL PROTOTYPE; ALTER PROJECT SECURITY DEMO USERS ON; -- Create demo accounts for each role CREATE DEMO USER 'demo_admin' PASSWORD 'Admin123!' ENTITY Administration.Account (Administrator); CREATE DEMO USER 'demo_user' PASSWORD 'User1234!' ENTITY Administration.Account (Employee); CREATE DEMO USER 'demo_guest' PASSWORD 'Guest123!' ENTITY Administration.Account (Guest); ``` -------------------------------- ### Example Usage Source: https://www.mxcli.org/library/reader-methods.html Demonstrates how to use various reader methods to access project information. ```APIDOC ## Example Usage ```go reader, _ := modelsdk.Open("/path/to/MyApp.mpr") defer reader.Close() fmt.Printf("Mendix version: %s\n", reader.GetMendixVersion()) modules, _ := reader.ListModules() for _, m := range modules { fmt.Printf("Module: %s\n", m.Name) dm, _ := reader.GetDomainModel(m.ID) for _, entity := range dm.Entities { fmt.Printf(" Entity: %s (persistent: %v)\n", entity.Name, entity.Persistable) for _, attr := range entity.Attributes { fmt.Printf(" - %s: %s\n", attr.Name, attr.Type.GetTypeName()) } } } microflows, _ := reader.ListMicroflows() fmt.Printf("Total microflows: %d\n", len(microflows)) pages, _ := reader.ListPages() fmt.Printf("Total pages: %d\n", len(pages)) ``` ``` -------------------------------- ### Example: Describe Nanoflow MyModule.NAV_ValidateInput Source: https://www.mxcli.org/reference/query/describe-microflow.html This example demonstrates describing a nanoflow named NAV_ValidateInput within the MyModule. The output will be the MDL source code of this nanoflow. ```bash DESCRIBE NANOFLOW MyModule.NAV_ValidateInput ``` -------------------------------- ### mxcli New Project Options Source: https://www.mxcli.org/tutorial/installation.html Examples of creating a new Mendix project with custom output directory or skipping AI tooling setup. ```bash mxcli new MyApp --version 10.24.0 --output-dir ./projects/my-app ``` ```bash mxcli new MyApp --version 11.8.0 --skip-init # Skip AI tooling setup ``` -------------------------------- ### Using mxcli in Codespace Playground Source: https://www.mxcli.org/tutorial/installation.html Commands to explore the Mendix project structure, run example scripts, or start the interactive REPL within the mxcli Codespace. ```bash ./mxcli -p App.mpr -c "SHOW STRUCTURE" # Explore the project ``` ```bash ./mxcli exec scripts/01-explore.mdl -p App.mpr # Run an example script ``` ```bash ./mxcli # Start interactive REPL ``` -------------------------------- ### Examples of Creating Demo Users Source: https://www.mxcli.org/language/demo-users.html Illustrates various ways to create demo users, from basic to more complex configurations with specific entities and multiple roles. ```sql __ -- Basic demo user CREATE DEMO USER 'demo_admin' PASSWORD 'Admin123!' (Administrator); -- With explicit entity CREATE DEMO USER 'demo_admin' PASSWORD 'Admin123!' ENTITY Administration.Account (Administrator); -- Multiple roles CREATE DEMO USER 'demo_manager' PASSWORD 'Manager1!' (Manager, Reporting); -- Standard user CREATE DEMO USER 'demo_user' PASSWORD 'User1234!' (Employee); ``` -------------------------------- ### Integrating Playwright Verify with CI/CD Source: https://www.mxcli.org/tools/playwright.html Combine `mxcli docker run --wait` with `mxcli playwright verify` for continuous integration. This example shows building and starting the app, then running verification scripts and generating JUnit XML output for CI systems. ```bash # Build and start the app mxcli docker run -p app.mpr --wait # Run all verification scripts mxcli playwright verify tests/ -p app.mpr --junit results.xml # JUnit XML output is consumed by CI systems (GitHub Actions, Jenkins, etc.) ``` -------------------------------- ### Connect to Oracle Source: https://www.mxcli.org/tools/sql-connect.html Example of connecting to an Oracle database using its driver and DSN. ```sql SQL CONNECT oracle 'oracle://user:password@host:1521/service_name' AS oradb; ``` -------------------------------- ### Create a New Mendix Project with mxcli Source: https://www.mxcli.org/tutorial/setup.html Use this command to create a new Mendix project from scratch, including all necessary tooling and Dev Container configuration. It automates the download of MxBuild, project creation, AI tool setup, and mxcli binary installation. ```bash mxcli new MyApp --version 11.8.0 ``` -------------------------------- ### Example: Creating Entities, Attributes, and Associations Source: https://www.mxcli.org/library/writer-methods.html Demonstrates a complete workflow of opening a project, creating a domain model, adding entities, attributes, and establishing an association between them. ```go __ writer, _ := modelsdk.OpenForWriting("/path/to/MyApp.mpr") defer writer.Close() reader := writer.Reader() modules, _ := reader.ListModules() dm, _ := reader.GetDomainModel(modules[0].ID) // Create entity customer := modelsdk.NewEntity("Customer") customer.Documentation = "Customer master data" customer.Location = model.Point{X: 100, Y: 200} writer.CreateEntity(dm.ID, customer) // Add attributes writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewStringAttribute("Name", 200)) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewStringAttribute("Email", 254)) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewBooleanAttribute("IsActive")) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewDateTimeAttribute("CreatedDate", true)) // Create association order := modelsdk.NewEntity("Order") writer.CreateEntity(dm.ID, order) assoc := modelsdk.NewAssociation("Customer_Order", customer.ID, order.ID) writer.CreateAssociation(dm.ID, assoc) ``` -------------------------------- ### MDL Entity Syntax Example Source: https://www.mxcli.org/preface/conventions.html This example illustrates the general syntax for creating an entity in MDL, using conventions like uppercase for keywords and brackets for optional clauses. ```sql CREATE [PERSISTENT] ENTITY module.name ( attribute_name: type [NOT NULL] [, ...] ); ``` -------------------------------- ### HashedString Attribute Example Source: https://www.mxcli.org/language/primitive-types.html Example of using HashedString for a password attribute. ```mdl Password: HashedString ``` -------------------------------- ### Example: Describe Microflow Sales.ACT_CreateOrder Source: https://www.mxcli.org/reference/query/describe-microflow.html This example shows how to describe a specific microflow named ACT_CreateOrder within the Sales module. The output will be the MDL source code of this microflow. ```bash DESCRIBE MICROFLOW Sales.ACT_CreateOrder ``` -------------------------------- ### Develop and Install VS Code Extension Source: https://www.mxcli.org/ide/vscode-installation.html Commands for developers to build and install the VS Code extension. Requires bun. The Makefile targets handle the build and installation process. ```bash # Requires bun (not npm/node) cd vscode-mdl bun install bun run compile # Package as VSIX make vscode-ext # Install the built VSIX make vscode-install ``` -------------------------------- ### List and Get Modules Source: https://www.mxcli.org/library/model-api.html Demonstrates how to list all available modules and retrieve a specific module by its name. ```go __ // List all modules modules, _ := modelAPI.Modules.ListModules() // Get a specific module module, _ := modelAPI.Modules.GetModule("MyModule") ``` -------------------------------- ### Create Sales Domain Model Example Source: https://www.mxcli.org/language/domain-model.html This example demonstrates creating a Sales domain model including an enumeration, entities with attributes and indexes, and an association between entities. ```mdl -- Enumeration for order statuses CREATE ENUMERATION Sales.OrderStatus ( Draft 'Draft', Pending 'Pending', Confirmed 'Confirmed', Shipped 'Shipped', Delivered 'Delivered', Cancelled 'Cancelled' ); -- Customer entity /** Customer master data */ @Position(100, 100) CREATE PERSISTENT ENTITY Sales.Customer ( CustomerId: AutoNumber NOT NULL UNIQUE DEFAULT 1, Name: String(200) NOT NULL ERROR 'Customer name is required', Email: String(200) UNIQUE ERROR 'Email already registered', Phone: String(50), IsActive: Boolean DEFAULT TRUE, CreatedAt: DateTime ) INDEX (Name) INDEX (Email); -- Order entity /** Sales order */ @Position(300, 100) CREATE PERSISTENT ENTITY Sales.Order ( OrderId: AutoNumber NOT NULL UNIQUE DEFAULT 1, OrderNumber: String(50) NOT NULL UNIQUE, OrderDate: DateTime NOT NULL, TotalAmount: Decimal DEFAULT 0, Status: Enumeration(Sales.OrderStatus) DEFAULT 'Draft', Notes: String(unlimited) ) INDEX (OrderNumber) INDEX (OrderDate DESC); -- Association: Order belongs to Customer CREATE ASSOCIATION Sales.Order_Customer FROM Sales.Customer TO Sales.Order TYPE Reference OWNER Default DELETE_BEHAVIOR DELETE_BUT_KEEP_REFERENCES; ``` -------------------------------- ### Override Constant Example Source: https://www.mxcli.org/language/project-settings.html Example of overriding the 'MyModule.ApiBaseUrl' constant for the 'default' configuration. ```mdl ALTER SETTINGS CONSTANT 'MyModule.ApiBaseUrl' VALUE 'https://staging.example.com' IN CONFIGURATION 'default'; ``` -------------------------------- ### Install mxbuild for Validation Source: https://www.mxcli.org/tutorial/quickstart.html Install mxbuild if you encounter the 'mx command not available' error. ```bash mxcli setup mxbuild -p your-app.mpr ``` -------------------------------- ### MDL File Syntax Highlighting Example Source: https://www.mxcli.org/ide/vscode-syntax.html This example demonstrates the basic syntax highlighting for MDL files, covering keywords, types, strings, numbers, comments, identifiers, and operators. Highlighting is immediate upon opening a file. ```mdl CREATE SHOW DESCRIBE ALTER GRANT String Integer Boolean DateTime 'Hello World' 100 3.14 -- line comment /** doc comment */ MyModule.Customer = != AND OR ``` -------------------------------- ### Check and Create Projects with mx Source: https://www.mxcli.org/tools/devcontainer.html These commands demonstrate how to check a project's validity and create a new project for testing using the `mx` binary, which is available on PATH after setup. ```bash # Find the mx binary MX=~/.mxcli/mxbuild/*/modeler/mx # Check a project $MX check /path/to/app.mpr # Create a fresh project for testing cd /tmp/test-workspace $MX create-project ``` -------------------------------- ### OData Service Example Source: https://www.mxcli.org/appendixes/quick-reference.html Example of creating an OData service with published entities and authentication. ```APIDOC ## CREATE ODATA SERVICE Example ### Description This example demonstrates how to create an OData service named `MyModule.CustomerAPI` and publish a `Customer` entity. ### Syntax ``` CREATE ODATA SERVICE MyModule.CustomerAPI ( Path: '/odata/customers', Version: '1.0.0', ODataVersion: OData4, Namespace: 'MyModule.Customers' ) AUTHENTICATION Basic, Session { PUBLISH ENTITY MyModule.Customer AS 'Customers' ( ReadMode: SOURCE, InsertMode: SOURCE, UpdateMode: NOT_SUPPORTED, DeleteMode: NOT_SUPPORTED, UsePaging: Yes, PageSize: 100 ) EXPOSE (Name, Email, Phone); }; ``` ``` -------------------------------- ### Running Catalog Queries with mxcli Source: https://www.mxcli.org/tools/catalog-sql.html Command-line examples for running catalog queries using the mxcli tool. Specify the project file and the SQL query using the -c flag. ```bash # Run a catalog query mxcli -p app.mpr -c "SELECT Name FROM CATALOG.ENTITIES WHERE ModuleName = 'Sales'" ``` ```bash # Query with limit mxcli -p app.mpr -c "SELECT Name FROM CATALOG.MICROFLOWS LIMIT 10" ``` -------------------------------- ### Boolean Attribute Examples Source: https://www.mxcli.org/language/primitive-types.html Examples of defining Boolean attributes with specified default values. ```mdl IsActive: Boolean DEFAULT TRUE Enabled: Boolean DEFAULT TRUE Deleted: Boolean DEFAULT FALSE ``` -------------------------------- ### Initialize Project Configuration Source: https://www.mxcli.org/reference/capabilities.html Set up the .claude/ directory within your project to configure skills and tooling. ```bash mxcli init ``` -------------------------------- ### Setup MX CLI Binary Source: https://www.mxcli.org/reference/capabilities.html Download and set up the platform-specific MX CLI binary. Specify '--os linux' for Linux systems. ```bash mxcli setup mxcli [--os linux] ``` -------------------------------- ### Set Default Language Example Source: https://www.mxcli.org/language/project-settings.html Example of setting the default application language to 'en_US'. ```mdl ALTER SETTINGS LANGUAGE DefaultLanguageCode = 'en_US'; ``` -------------------------------- ### Create Demo User Syntax Source: https://www.mxcli.org/language/demo-users.html Use this syntax to create a new demo user. You can specify the username, password, entity, and user roles. ```sql __ CREATE DEMO USER '' PASSWORD '' [ENTITY .] ( [, ...]); ``` -------------------------------- ### Verifying mxcli Installation Source: https://www.mxcli.org/tutorial/installation.html Command to check if mxcli is installed correctly and display its version information. ```bash mxcli --version ``` -------------------------------- ### Grant Examples Source: https://www.mxcli.org/reference/security/grant.html Illustrative examples of using the GRANT statement for various access control scenarios. ```APIDOC ## Examples Grant full entity access: ``` GRANT Shop.Admin ON Shop.Customer (CREATE, DELETE, READ *, WRITE *); ``` Grant read-only access: ``` GRANT Shop.Viewer ON Shop.Customer (READ *); ``` Grant selective attribute access: ``` GRANT Shop.User ON Shop.Customer (READ (Name, Email), WRITE (Email)); ``` Grant entity access with an XPath constraint: ``` GRANT Shop.User ON Shop.Order (READ *, WRITE *) WHERE '[Status = ''Open'']'; ``` Grant microflow execution to multiple roles: ``` GRANT EXECUTE ON MICROFLOW Shop.ACT_Order_Process TO Shop.User, Shop.Admin; ``` Grant page visibility: ``` GRANT VIEW ON PAGE Shop.Order_Overview TO Shop.User, Shop.Admin; ``` Grant nanoflow execution: ``` GRANT EXECUTE ON NANOFLOW Shop.NAV_ValidateInput TO Shop.User; ``` Additive grant – add new attribute access without removing existing: ``` -- Viewer already has READ (Name, Email) GRANT Shop.Viewer ON Shop.Customer (READ (Phone)); -- Result: READ (Name, Email, Phone) ``` ``` -------------------------------- ### Comprehensive Module Creation with Fluent API Source: https://www.mxcli.org/library/fluent-examples.html This example creates a complete module including enumerations, entities with various attributes and associations, and a microflow, all using the fluent API. ```go package main import ( "log" "github.com/mendixlabs/mxcli/api" "github.com/mendixlabs/mxcli/sdk/mpr" ) func main() { writer, err := mpr.OpenForWriting("/path/to/MyApp.mpr") if err != nil { log.Fatal(err) } defer writer.Close() modelAPI := api.New(writer) module, _ := modelAPI.Modules.GetModule("ProductCatalog") modelAPI.SetModule(module) // Enumeration _, _ = modelAPI.Enumerations.CreateEnumeration("ProductCategory"). WithValue("Electronics", "Electronics"). WithValue("Clothing", "Clothing"). WithValue("HomeGarden", "Home & Garden"). Build() // Entities _, _ = modelAPI.DomainModels.CreateEntity("Product"). Persistent(). WithStringAttribute("SKU", 50). WithStringAttribute("Name", 200). WithDecimalAttribute("Price"). WithIntegerAttribute("StockQuantity"). WithBooleanAttribute("IsActive"). WithEnumerationAttribute("Category", "ProductCatalog.ProductCategory"). Build() _, _ = modelAPI.DomainModels.CreateEntity("Supplier"). Persistent(). WithStringAttribute("CompanyName", 200). WithStringAttribute("ContactEmail", 254). Build() // Association _, _ = modelAPI.DomainModels.CreateAssociation("Product_Supplier"). From("Product"). To("Supplier"). OneToMany(). Build() // Microflow _, _ = modelAPI.Microflows.CreateMicroflow("ValidateProduct"). WithParameter("Product", "ProductCatalog.Product"). ReturnsBoolean(). Build() } ``` -------------------------------- ### DROP ENTITY Example Source: https://www.mxcli.org/reference/domain-model/drop-entity.html This is an example of how to drop a specific entity named 'CustomerFilter' from the 'Sales' module. ```mxcli DROP ENTITY Sales.CustomerFilter; ``` -------------------------------- ### CREATE DEMO USER Syntax Source: https://www.mxcli.org/reference/security/create-demo-user.html This is the general syntax for creating a demo user. Demo users are visible on the local login screen and require project security to have demo users enabled. ```sql CREATE DEMO USER 'username' PASSWORD 'password' [ ENTITY module.Entity ] ( UserRole [, ...]) ``` -------------------------------- ### Example: Remove Nanoflow Execution Source: https://www.mxcli.org/reference/security/revoke.html This example revokes the execute permission for the 'Shop.NAV_ValidateInput' nanoflow from the 'Shop.Viewer' role. ```mxm REVOKE EXECUTE ON NANOFLOW Shop.NAV_ValidateInput FROM Shop.Viewer; ``` -------------------------------- ### Example: Remove Page Visibility Source: https://www.mxcli.org/reference/security/revoke.html This example revokes the view permission for the 'Shop.Admin_Dashboard' page from the 'Shop.User' role. ```mxm REVOKE VIEW ON PAGE Shop.Admin_Dashboard FROM Shop.User; ``` -------------------------------- ### Example output for a one-to-many association Source: https://www.mxcli.org/reference/query/describe-association.html This is an example of the output generated by the `DESCRIBE ASSOCIATION` command for a one-to-many relationship. ```mdl /** Links orders to customers */ CREATE ASSOCIATION Sales.Order_Customer FROM Sales.Customer TO Sales.Order TYPE Reference OWNER Default DELETE_BEHAVIOR DELETE_BUT_KEEP_REFERENCES; ``` -------------------------------- ### Start REPL and Open Project Source: https://www.mxcli.org/tutorial/opening-project.html Launch the mxcli interactive REPL. You can then open a project using the OPEN PROJECT command. ```bash mxcli ``` ```mxcli OPEN PROJECT '/path/to/app.mpr'; SHOW MODULES; ``` -------------------------------- ### Full development workflow with mxcli Source: https://www.mxcli.org/tutorial/validation.html Demonstrates the recommended workflow for making changes: write MDL, check syntax, check references, execute, perform full validation, and open in Studio Pro. ```bash # 1. Write your MDL in a script file cat > changes.mdl << 'EOF' CREATE OR MODIFY PERSISTENT ENTITY MyModule.Product ( Name: String(200) NOT NULL, Price: Decimal, IsActive: Boolean DEFAULT true ); CREATE OR MODIFY MICROFLOW MyModule.CreateProduct( DECLARE $Name: String, DECLARE $Price: Decimal ) RETURN MyModule.Product BEGIN CREATE $Product: MyModule.Product ( Name = $Name, Price = $Price, IsActive = true ); COMMIT $Product; RETURN $Product; END; EOF # 2. Check syntax (fast, no project needed) mxcli check changes.mdl # 3. Check references (needs project, still fast) mxcli check changes.mdl -p app.mpr --references # 4. Execute against the project mxcli exec changes.mdl -p app.mpr # 5. Full validation mxcli docker check -p app.mpr # 6. Open in Studio Pro and verify visually ``` -------------------------------- ### Binary Attribute Examples Source: https://www.mxcli.org/language/primitive-types.html Examples of using the Binary data type for attributes storing binary content. ```mdl ProfileImage: Binary Document: Binary Thumbnail: Binary ``` -------------------------------- ### Show All Project Settings - mxcli Source: https://www.mxcli.org/reference/settings/show-settings.html Use `SHOW SETTINGS` for a compact overview of all settings across all categories. This command provides a quick summary of the project's configuration. ```bash SHOW SETTINGS; ``` -------------------------------- ### Date Attribute Examples Source: https://www.mxcli.org/language/primitive-types.html Examples of using the Date data type for attributes that only require a date component. ```mdl BirthDate: Date ExpiryDate: Date ``` -------------------------------- ### NOT NULL Constraint Example Source: https://www.mxcli.org/language/constraints.html Ensures an attribute is required and cannot be empty. Includes an example with a custom error message. ```plaintext __ Name: String(200) NOT NULL ``` ```plaintext __ Name: String(200) NOT NULL ERROR 'Name is required' ``` -------------------------------- ### Building mxcli from Source Source: https://www.mxcli.org/tutorial/installation.html Instructions to clone the mxcli repository and build the binary using Go and Make. Requires Go 1.24+ and Make. ```bash git clone https://github.com/mendixlabs/mxcli.git cd mxcli make build ``` -------------------------------- ### Entity Definition Example Source: https://www.mxcli.org/ide/vscode-intellisense.html This is an example of an entity definition that would be displayed when hovering over a qualified entity reference. ```mdl CREATE PERSISTENT ENTITY Sales.Customer ( Name: String(200) NOT NULL, Email: String(200), IsActive: Boolean DEFAULT true ); ``` -------------------------------- ### Query Application with OQL Source: https://www.mxcli.org/tools/docker-run.html Once the application is running in Docker, you can query it using OQL. This example retrieves all records from the Sales.Customer entity. ```bash mxcli oql -p app.mpr "SELECT * FROM Sales.Customer" ``` -------------------------------- ### Show full project structure with all modules Source: https://www.mxcli.org/reference/query/show-structure.html Displays the complete project structure with full detail, including all modules (user, system, and marketplace). Use this for a comprehensive view. ```bash SHOW STRUCTURE DEPTH 3 ALL ``` -------------------------------- ### mxcli TUI Command Examples Source: https://www.mxcli.org/tools/tui-commands.html Examples of using mxcli TUI commands with qualified names for element analysis. ```shell :callers MyModule.ACT_CreateCustomer ``` ```shell :impact MyModule.Customer ``` -------------------------------- ### DateTime Attribute Examples Source: https://www.mxcli.org/language/primitive-types.html Examples of using the DateTime data type for attributes that store specific points in time. ```mdl CreatedAt: DateTime ModifiedAt: DateTime ScheduledFor: DateTime ``` -------------------------------- ### Long Attribute Examples Source: https://www.mxcli.org/language/primitive-types.html Examples of using the Long data type for attributes, including setting default values. ```mdl FileSize: Long TotalCount: Long DEFAULT 0 ``` -------------------------------- ### Starlark Rule Installation Directory Source: https://www.mxcli.org/tools/starlark-rules.html When mxcli init is run, Starlark rules are installed in the .claude/lint-rules directory within your project. ```bash your-project/ └── .claude/ └── lint-rules/ ├── sec004_guest_access.star ├── arch001_cross_module.star ├── qual001_complexity.star └── ... ``` -------------------------------- ### Full Example: Modifying a Mendix Project Source: https://www.mxcli.org/library/modifying.html Demonstrates opening a project for writing, accessing its reader, and performing common modifications like creating entities, adding attributes, and establishing associations. ```go __ package main import ( "github.com/mendixlabs/mxcli" ) func main() { // Open for writing writer, err := modelsdk.OpenForWriting("/path/to/MyApp.mpr") if err != nil { panic(err) } defer writer.Close() reader := writer.Reader() modules, _ := reader.ListModules() dm, _ := reader.GetDomainModel(modules[0].ID) // Create a new entity customer := modelsdk.NewEntity("Customer") writer.CreateEntity(dm.ID, customer) // Add attributes writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewStringAttribute("Name", 200)) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewStringAttribute("Email", 254)) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewBooleanAttribute("IsActive")) writer.AddAttribute(dm.ID, customer.ID, modelsdk.NewDateTimeAttribute("CreatedDate", true)) // Create another entity order := modelsdk.NewEntity("Order") writer.CreateEntity(dm.ID, order) // Create an association assoc := modelsdk.NewAssociation("Customer_Order", customer.ID, order.ID) writer.CreateAssociation(dm.ID, assoc) } ``` -------------------------------- ### mxcli TUI Search Command Example Source: https://www.mxcli.org/tools/tui-commands.html Example of using the :search command in the mxcli TUI to perform full-text searches. ```shell :search validation ``` ```shell :search Customer ``` -------------------------------- ### Create Basic Page Source: https://www.mxcli.org/language/page-structure.html Example of creating a simple page with a title and layout, containing a DataGrid widget. ```mdl CREATE PAGE MyModule.CustomerList ( Title: 'Customers', Layout: Atlas_Core.Atlas_Default ) { -- Widgets here fill the main content area of Atlas_Default DATAGRID dgCustomers (DataSource: DATABASE MyModule.Customer) { COLUMN colName (Attribute: Name, Caption: 'Name') COLUMN colEmail (Attribute: Email, Caption: 'Email') } } ``` -------------------------------- ### Install Playwright CLI and Browser Source: https://www.mxcli.org/tools/playwright.html Install playwright-cli globally and download the Chromium browser. This is a prerequisite for running automated UI tests. ```bash npm install -g @playwright/cli@latest && playwright-cli install --with-deps chromium ``` -------------------------------- ### Example: Remove Microflow Execution from Multiple Roles Source: https://www.mxcli.org/reference/security/revoke.html This example revokes the execute permission for the 'Shop.ACT_Order_Process' microflow from both 'Shop.Viewer' and potentially other roles. ```mxm REVOKE EXECUTE ON MICROFLOW Shop.ACT_Order_Process FROM Shop.Viewer; ``` -------------------------------- ### Setup mxbuild or Use Automatic Download Source: https://www.mxcli.org/tools/docker-build.html Explicitly set up the mxbuild version for your project or rely on `mxcli docker build` to handle the download automatically. Downloaded mxbuild is cached for reuse. ```bash # Explicit setup mxcli setup mxbuild -p app.mpr # Or let docker build handle it automatically mxcli docker build -p app.mpr ``` -------------------------------- ### Example: Remove All Entity Access for a Role Source: https://www.mxcli.org/reference/security/revoke.html This example demonstrates how to completely remove all access rights for the 'Shop.Viewer' role on the 'Shop.Customer' entity. ```mxm REVOKE Shop.Viewer ON Shop.Customer; ```