Thank you for your interest in contributing to mxcli! This document explains what we expect from contributors and how to make effective contributions.
- Quick Start
- Contribution Workflow
- Quality Requirements
- Testing Your Changes
- Testing with Agentic Code (Claude Code)
- Git Workflow
- Code Standards
- Documentation
- Troubleshooting
- Go 1.26+
- Git
- Make
- (Optional) Docker or Podman 4.7+ for dev container
- (Optional) Claude Code / Cursor for agentic development
Option 1: Dev Container (Recommended)
git clone https://github.com/mendixlabs/mxcli
cd mxcli
# Open in VS Code, then: Command Palette -> "Reopen in Container"
# Podman users: select the "Mendix Model SDK Go (Podman)" configurationOption 2: Local Machine
git clone https://github.com/mendixlabs/mxcli
cd mxcli
make build
./bin/mxcli --helpmake build # Build binary
make test # Run unit tests
make test-mdl # Run MDL integration tests
make lint # Run linter (fmt + vet)
make clean # Clean build artifacts
make grammar # Regenerate ANTLR parser (after modifying mdl/grammar/MDLParser.g4)We follow a strict workflow to ensure quality and prevent duplicate work.
Always file an issue before starting work. This prevents wasted effort and duplicate contributions.
- Go to Issues -> New Issue
- Choose template: Bug or Feature
- Fill out all required fields
- Provide clear context and expected behavior
- Submit issue (don't start coding yet!)
Examples:
- Bug: "Creating entity with 200+ character name causes parser error"
- Feature: "Add
mxcli impactcommand to analyze change impact"
The maintainer will review and respond:
- Approved: "Let's do it!" -> Go to Step 3
- Needs clarification: Respond to questions
- Not aligned: "We're focusing on X instead" -> Discuss or close
Don't start coding until the issue is approved.
Once approved:
- Click Assignees -> Select yourself
- This signals you're working on it
- Prevents others from duplicating your work
- Gives the maintainer visibility on what's in progress
Create a feature branch with a descriptive name:
git checkout -b feature/123-add-impact-command
git checkout -b fix/456-entity-parser-unicode
git checkout -b docs/789-add-mdl-examplesCommit messages should reference the issue:
git commit -m "feat: add impact command for change analysis (closes #123)"
git commit -m "fix: handle 200+ character entity names (closes #456)"This is critical. Validate that your code works before pushing.
make build # Must succeed
make test # Must pass all tests
make lint # Must have no issuesIf your change adds or modifies MDL syntax:
make grammar # Regenerate parser
./bin/mxcli check your-script.mdl # Verify syntax parsesAdd working examples in mdl-examples/doctype-tests/ for any new syntax.
Required for any change that affects Mendix project behavior (new MDL statements, BSON serialization, entity/microflow modifications).
- Apply your changes to a test
.mprproject - Open the project in Mendix Studio Pro
- Verify no errors (
mx checkor Studio Pro's error list) - Document the Mendix version you tested with
Example validation:
Tested: Created entity with FOLDER clause via MDL
Mendix version: 11.8.0
Result: mx check passes, entity appears in correct folder in Studio Pro
git push origin feature/123-add-impact-commandIn your PR description:
- Link issue: "Closes #123"
- What does it do?: Brief description
- Testing: Confirm
make testandmake lintpass - Mendix validation: Document what you tested and which version
- Agentic testing: Confirm Claude Code can use the feature (see below)
GitHub Actions automatically verify:
- Code compiles
- Tests pass
- Integration tests pass (with
mx checkagainst real Mendix runtime)
If any check fails: Fix locally and push again.
The maintainer will:
- Review code quality and architecture
- Verify documentation completeness
- Check Mendix Studio Pro validation claim
- Verify the PR checklist in CLAUDE.md is satisfied
Once approved, the PR is merged.
Every PR is checked against the review checklist in CLAUDE.md. Key items:
| Area | Requirements |
|---|---|
| Full-stack MDL | Grammar, parser regenerated, AST, visitor, executor, DESCRIBE roundtrip |
| Test coverage | MDL examples in mdl-examples/doctype-tests/, integration paths tested |
| Version compat | Version-gated features have registry entry and executor pre-check |
| Security | Restrictive socket permissions, no file I/O in hot paths |
| Scope | One concern per PR, refactors in separate commits |
| Documentation | Skills, CLI help text, syntax reference, site docs updated |
make build # Code compiles (CGO_ENABLED=0, no C compiler needed)
make test # All tests pass
make lint # go fmt + go vet passTest files are *_test.go in the same package. This project uses the standard testing package:
func TestCreateEntityWithLongName(t *testing.T) {
reader, err := modelsdk.Open("testdata/test.mpr")
if err != nil {
t.Fatalf("failed to open project: %v", err)
}
defer reader.Close()
entities, err := reader.ListEntities()
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if len(entities) == 0 {
t.Fatal("expected at least one entity")
}
}For new MDL commands, add test scripts in mdl-examples/doctype-tests/:
-- Create a module for testing
CREATE MODULE TestFeature;
-- Test the new feature
CREATE JSON STRUCTURE TestFeature.MyStructure
FOLDER 'Resources'
SNIPPET '{"id": 1, "name": "test"}';
-- Verify it exists
DESCRIBE JSON STRUCTURE TestFeature.MyStructure;
-- Clean up
DROP JSON STRUCTURE TestFeature.MyStructure;Validate with:
./bin/mxcli check mdl-examples/doctype-tests/your-test.mdlThe CI runs TestMxCheck_DoctypeScripts which executes each MDL script against a real Mendix project and validates with mx check. Your test script must produce zero errors.
mxcli is designed for AI agents to use. Your contribution must work well with them.
mxcli's primary value is that AI agents (Claude Code, Cursor, etc.) can generate correct MDL scripts. If an agent can't understand or use your feature, the feature needs more work.
- Open the dev container with Claude Code installed
- Ask Claude Code to use your feature without giving it the exact syntax:
I want to create a JSON structure for a customer API response with name, email, and an addresses array. Can you write the MDL? - Evaluate the result:
- Did Claude generate correct MDL syntax?
- Did it find the right skill/documentation?
- Did the generated script pass
mxcli check?
| Problem | Fix |
|---|---|
| Claude doesn't know the syntax exists | Add/update skill in .claude/skills/ |
| Claude generates wrong syntax | Improve examples in skill files |
| Claude uses outdated patterns | Update CLI help text (Short/Long/Example in Cobra) |
| Error messages are unhelpful | Improve error text with hints |
Include in your PR:
## Agentic Code Testing
- [ ] Tested with Claude Code in dev container
- [ ] Claude can generate correct MDL for this feature
- [ ] Skills updated (if applicable)
- [ ] Error messages are helpful for debuggingfeature/123-add-impact-command
fix/456-handle-unicode-names
docs/789-add-mdl-examples
refactor/101-simplify-catalog
Use conventional commits:
feat: add impact command for change analysis (closes #123)
fix: handle unicode characters in entity names (closes #456)
docs: add examples for CREATE WORKFLOW (closes #789)
refactor: simplify executor dispatch logic
- Each commit does one thing (feature, bugfix, or refactor)
- Each PR is scoped to a single feature or concern
- Independent features go in separate PRs even if developed together
- Refactors that touch many files get their own commit
- Follow
go fmtandgo vet - Use descriptive names matching Mendix terminology
- Keep BSON/JSON tags consistent with Mendix serialization format
- Export types that should be part of the public API
- Handle all errors (no
_for error returns)
| Directory | Purpose |
|---|---|
cmd/mxcli/ |
CLI commands (Cobra) |
sdk/mpr/ |
MPR file reading/writing, BSON parsing |
sdk/microflows/, sdk/pages/, etc. |
Domain types |
mdl/grammar/ |
ANTLR4 grammar (MDLParser.g4, MDLLexer.g4) |
mdl/ast/ |
AST node types |
mdl/visitor/ |
ANTLR listener -> AST |
mdl/executor/ |
AST execution against modelsdk |
mdl/catalog/ |
SQLite catalog for project metadata queries |
api/ |
High-level fluent API |
.claude/skills/ |
AI agent skill documentation |
docs-site/src/ |
Documentation site pages |
Critical: Mendix uses different storage names in BSON $Type fields than the qualified names in SDK documentation. Always verify against reference/mendixmodellib/reflection-data/ or existing MPR files. See the table in CLAUDE.md for common mismatches.
| Change | Where to Document |
|---|---|
| New CLI command | Cobra Short/Long/Example fields |
| New MDL statement | docs/01-project/MDL_QUICK_REFERENCE.md, skill in .claude/skills/ |
| New SDK function | Godoc comments, docs/GO_LIBRARY.md |
| New site-facing feature | docs-site/src/ pages |
| Changelog-worthy change | CHANGELOG.md (unreleased section) |
Update CHANGELOG.md:
## [Unreleased]
### Added
- `DESCRIBE NANOFLOW` with activities and control flows (#42)
- FOLDER support for CREATE JSON STRUCTURE (#38)
### Fixed
- Nanoflow parser now reads activities and return type from BSON (#43)make build # Ensure binary is up to date
make test # Run tests, read error output
make lint # Check formatting and vetmake grammar # Regenerate ANTLR parser after .g4 changes
make build # Rebuild with new parserThe CI uses a specific Mendix version (check .github/workflows/). Ensure your BSON serialization matches what that version expects. See .claude/skills/debug-bson.md for the debugging workflow.
- Open the project in VS Code -> Reopen in Container
- Claude Code is auto-installed in the dev container
- Ask it to use your feature and verify the output
- Go to Actions tab -> click the failing run
- Expand the failing job and read the error
- Fix locally with
make test/make lint/make build - Push again
- Question about workflow? Ask in the issue
- Stuck on implementation? Comment in the PR
- Design discussion? Create an issue with a proposal
- Need feedback on approach? Comment on the issue before coding
| Stage | What's Expected |
|---|---|
| Before coding | File issue, get approval, assign to yourself |
| While coding | Follow architecture, write tests, follow style |
| Before pushing | make build + make test + make lint pass |
| In the PR | Mendix Studio Pro validation, Claude Code testing documented |
| Review | Documentation complete, PR checklist satisfied |
Thank you for contributing!