Skip to content

Commit 7cf3bb0

Browse files
committed
docs: add OpenCode integration documentation
- New dedicated tutorial page (docs-site/src/tutorial/opencode.md) - Add OpenCode to SUMMARY.md nav after claude-code.md - Update ai-assistants.md: count five -> six, add OpenCode row - Update other-ai-tools.md: add OpenCode section with link to dedicated page - Update mxcli-init.md Supported AI Tools table with OpenCode row - Update README.md intro sentence and Supported AI Tools table
1 parent f1064e6 commit 7cf3bb0

File tree

6 files changed

+210
-3
lines changed

6 files changed

+210
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
>
55
> **Do not edit a project with mxcli while it is open in Studio Pro.** Studio Pro maintains in-memory caches that cannot be updated externally. Close the project in Studio Pro first, run mxcli, then re-open the project.
66
7-
A command-line tool that enables AI coding assistants ([Claude Code](https://claude.ai/claude-code), Cursor, Continue.dev, Windsurf, Aider, and others) to read, understand, and modify Mendix application projects.
7+
A command-line tool that enables AI coding assistants ([Claude Code](https://claude.ai/claude-code), OpenCode, Cursor, Continue.dev, Windsurf, Aider, and others) to read, understand, and modify Mendix application projects.
88

99
**[Read the documentation](https://mendixlabs.github.io/mxcli/)** | **[Try it in the Playground](https://codespaces.new/mendixlabs/mxcli-playground)** -- no install needed, runs in your browser
1010

@@ -125,6 +125,7 @@ claude # or use Cursor, Continue.dev, etc.
125125
| Tool | Config File | Description |
126126
|------|------------|-------------|
127127
| **Claude Code** | `.claude/`, `CLAUDE.md` | Full integration with skills and commands |
128+
| **OpenCode** | `.opencode/`, `opencode.json` | Skills, commands, and lint rules |
128129
| **Cursor** | `.cursorrules` | Compact MDL reference and command guide |
129130
| **Continue.dev** | `.continue/config.json` | Custom commands and slash commands |
130131
| **Windsurf** | `.windsurfrules` | Codeium's AI with MDL rules |

docs-site/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- [Validating with mxcli check](tutorial/validation.md)
2727
- [Working with AI Assistants](tutorial/ai-assistants.md)
2828
- [Claude Code Integration](tutorial/claude-code.md)
29+
- [OpenCode Integration](tutorial/opencode.md)
2930
- [Cursor / Continue.dev / Windsurf](tutorial/other-ai-tools.md)
3031
- [Skills and CLAUDE.md](tutorial/skills.md)
3132
- [The MDL + AI Workflow](tutorial/mdl-ai-workflow.md)

docs-site/src/ide/mxcli-init.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mxcli init --list-tools
2626
| Tool | Flag | Config Files Created |
2727
|------|------|---------------------|
2828
| **Claude Code** (default) | `--tool claude` | `.claude/settings.json`, `CLAUDE.md`, commands, lint rules |
29+
| **OpenCode** | `--tool opencode` | `.opencode/`, `opencode.json`, commands, skills, lint rules |
2930
| **Cursor** | `--tool cursor` | `.cursorrules` |
3031
| **Continue.dev** | `--tool continue` | `.continue/config.json` |
3132
| **Windsurf** | `--tool windsurf` | `.windsurfrules` |

docs-site/src/tutorial/ai-assistants.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ Fewer tokens means lower API costs, more of your application fits in a single pr
2222

2323
## Supported AI tools
2424

25-
mxcli supports five AI coding assistants out of the box, plus a universal format that works with any tool:
25+
mxcli supports six AI coding assistants out of the box, plus a universal format that works with any tool:
2626

2727
| Tool | Init Flag | Config File | Description |
2828
|------|-----------|-------------|-------------|
2929
| **Claude Code** | `--tool claude` (default) | `.claude/`, `CLAUDE.md` | Full integration with skills, commands, and lint rules |
30+
| **OpenCode** | `--tool opencode` | `.opencode/`, `opencode.json` | Deep integration with skills, commands, and lint rules |
3031
| **Cursor** | `--tool cursor` | `.cursorrules` | Compact MDL reference and command guide |
3132
| **Continue.dev** | `--tool continue` | `.continue/config.json` | Custom commands and slash commands |
3233
| **Windsurf** | `--tool windsurf` | `.windsurfrules` | Codeium's AI with MDL rules |

docs-site/src/tutorial/opencode.md

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# OpenCode Integration
2+
3+
OpenCode is a fully supported AI integration for mxcli. It gets deep support: a dedicated configuration directory, project-level context in `AGENTS.md`, skill files that teach the AI MDL patterns, slash commands for common operations, and Starlark lint rules.
4+
5+
## Initializing a project
6+
7+
Use the `--tool opencode` flag:
8+
9+
```bash
10+
mxcli init --tool opencode /path/to/my-mendix-project
11+
```
12+
13+
To set up both OpenCode and Claude Code together:
14+
15+
```bash
16+
mxcli init --tool opencode --tool claude /path/to/my-mendix-project
17+
```
18+
19+
## What gets created
20+
21+
After running `mxcli init --tool opencode`, your project directory gains:
22+
23+
```
24+
my-mendix-project/
25+
├── AGENTS.md # Universal AI assistant guide (OpenCode reads this)
26+
├── opencode.json # OpenCode configuration file
27+
├── .opencode/
28+
│ ├── commands/ # Slash commands (/create-entity, etc.)
29+
│ └── skills/ # MDL pattern guides (OpenCode skill format)
30+
│ ├── write-microflows/
31+
│ │ └── SKILL.md
32+
│ ├── create-page/
33+
│ │ └── SKILL.md
34+
│ └── ...
35+
├── .claude/
36+
│ └── lint-rules/ # Starlark lint rules (shared with mxcli lint)
37+
├── .ai-context/
38+
│ ├── skills/ # Shared skill files (universal copy)
39+
│ └── examples/ # Example MDL scripts
40+
├── .devcontainer/
41+
│ ├── devcontainer.json # Dev container configuration
42+
│ └── Dockerfile # Container image with mxcli, JDK, Docker
43+
├── mxcli # CLI binary (copied into project)
44+
└── app.mpr # Your Mendix project (already existed)
45+
```
46+
47+
### opencode.json
48+
49+
The `opencode.json` file is OpenCode's primary configuration. It points to `AGENTS.md` for instructions and to the skill files in `.opencode/skills/`:
50+
51+
```json
52+
{
53+
"instructions": ["AGENTS.md", ".ai-context/skills/*.md"],
54+
"model": "anthropic/claude-sonnet-4-5"
55+
}
56+
```
57+
58+
### Skills
59+
60+
Skills live in `.opencode/skills/<name>/SKILL.md` and use YAML frontmatter that OpenCode understands:
61+
62+
```markdown
63+
---
64+
name: write-microflows
65+
description: MDL syntax and patterns for creating microflows
66+
compatibility: opencode
67+
---
68+
69+
# Writing Microflows
70+
...
71+
```
72+
73+
Each skill covers a specific area: microflow syntax, page patterns, security setup, and so on. OpenCode reads the relevant skill before generating MDL, which significantly improves output quality.
74+
75+
### Commands
76+
77+
The `.opencode/commands/` directory contains slash commands available inside OpenCode. These mirror the Claude Code commands: `/create-entity`, `/create-microflow`, `/create-page`, `/lint`, and others.
78+
79+
### Lint rules
80+
81+
Lint rules live in `.claude/lint-rules/` regardless of which tool is selected — this is where `mxcli lint` looks for custom Starlark rules. OpenCode init writes the rules there so `mxcli lint` works the same way for both tool choices.
82+
83+
## Setting up the dev container
84+
85+
The dev container setup is identical to the Claude Code workflow. Open your project folder in VS Code, click **"Reopen in Container"** when prompted, and wait for the container to build.
86+
87+
### What's installed in the container
88+
89+
| Component | Purpose |
90+
|-----------|---------|
91+
| **mxcli** | Mendix CLI (copied into project root) |
92+
| **MxBuild / mx** | Mendix project validation and building |
93+
| **JDK 21** (Adoptium) | Required by MxBuild |
94+
| **Docker-in-Docker** | Running Mendix apps locally with `mxcli docker` |
95+
| **Node.js** | Playwright testing support |
96+
| **PostgreSQL client** | Database connectivity |
97+
98+
## Starting OpenCode
99+
100+
With the dev container running, open a terminal in VS Code and start OpenCode:
101+
102+
```bash
103+
opencode
104+
```
105+
106+
OpenCode now has access to your project files, the mxcli binary, the skill files in `.opencode/skills/`, and the commands in `.opencode/commands/`.
107+
108+
## How OpenCode works with your project
109+
110+
The workflow mirrors Claude Code exactly:
111+
112+
### 1. Explore
113+
114+
OpenCode uses mxcli commands to understand the project before making changes:
115+
116+
```sql
117+
-- What modules exist?
118+
SHOW MODULES;
119+
120+
-- What entities are in this module?
121+
SHOW ENTITIES IN Sales;
122+
123+
-- What does this entity look like?
124+
DESCRIBE ENTITY Sales.Customer;
125+
126+
-- What microflows exist?
127+
SHOW MICROFLOWS IN Sales;
128+
129+
-- Search for something specific
130+
SEARCH 'validation';
131+
```
132+
133+
### 2. Read the relevant skill
134+
135+
Before writing MDL, OpenCode reads the appropriate skill file from `.opencode/skills/`. If you ask for a microflow, it reads the `write-microflows` skill. If you ask for a page, it reads `create-page`.
136+
137+
### 3. Write MDL
138+
139+
OpenCode generates an MDL script based on the project context and skill guidance:
140+
141+
```sql
142+
/** Customer master data */
143+
@Position(100, 100)
144+
CREATE PERSISTENT ENTITY Sales.Customer (
145+
Name: String(200) NOT NULL,
146+
Email: String(200) NOT NULL,
147+
Phone: String(50),
148+
IsActive: Boolean DEFAULT true
149+
);
150+
```
151+
152+
### 4. Validate
153+
154+
```bash
155+
./mxcli check script.mdl
156+
./mxcli check script.mdl -p app.mpr --references
157+
```
158+
159+
### 5. Execute
160+
161+
```bash
162+
./mxcli -p app.mpr -c "EXECUTE SCRIPT 'script.mdl'"
163+
```
164+
165+
### 6. Verify
166+
167+
```bash
168+
./mxcli docker check -p app.mpr
169+
```
170+
171+
## Adding OpenCode to an existing project
172+
173+
If you already ran `mxcli init` for another tool and want to add OpenCode support:
174+
175+
```bash
176+
mxcli add-tool opencode
177+
```
178+
179+
This creates `.opencode/`, `opencode.json`, and the lint rules without touching any existing configuration.
180+
181+
## Tips for working with OpenCode
182+
183+
- **Be specific about module names.** Say "Create a Customer entity in the Sales module" rather than just "Create a Customer entity."
184+
- **Mention existing elements.** If you want an association to an existing entity, name it: "Link Order to the existing Sales.Customer entity."
185+
- **Let the AI explore first.** OpenCode will run SHOW and DESCRIBE commands to understand what's already in the project. This leads to better results.
186+
- **Review in Studio Pro.** After changes are applied, open the project in Studio Pro to verify the result visually.
187+
- **Use `mxcli docker check`** to catch issues that `mxcli check` alone might miss.
188+
189+
## Next steps
190+
191+
To understand what the skill files contain and how they guide AI behavior, see [Skills and CLAUDE.md](skills.md). For other supported tools, see [Cursor / Continue.dev / Windsurf](other-ai-tools.md).

docs-site/src/tutorial/other-ai-tools.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# Cursor / Continue.dev / Windsurf
22

3-
Claude Code is the default integration, but mxcli also supports Cursor, Continue.dev, Windsurf, and Aider. Each tool gets its own configuration file that teaches the AI about MDL syntax and mxcli commands.
3+
Claude Code is the default integration, but mxcli also supports OpenCode, Cursor, Continue.dev, Windsurf, and Aider. Each tool gets its own configuration file that teaches the AI about MDL syntax and mxcli commands.
44

55
## Initializing for a specific tool
66

77
Use the `--tool` flag to specify which AI tool you use:
88

99
```bash
10+
# OpenCode
11+
mxcli init --tool opencode /path/to/my-mendix-project
12+
1013
# Cursor
1114
mxcli init --tool cursor /path/to/my-mendix-project
1215

@@ -60,13 +63,22 @@ On top of the universal files, each tool gets its own configuration:
6063
| Tool | Config File | Contents |
6164
|------|-------------|----------|
6265
| **Claude Code** | `.claude/`, `CLAUDE.md` | Settings, skills, commands, lint rules, project context |
66+
| **OpenCode** | `.opencode/`, `opencode.json` | Skills, commands, lint rules, project context |
6367
| **Cursor** | `.cursorrules` | Compact MDL reference and mxcli command guide |
6468
| **Continue.dev** | `.continue/config.json` | Custom commands and slash commands |
6569
| **Windsurf** | `.windsurfrules` | MDL rules for Codeium's AI |
6670
| **Aider** | `.aider.conf.yml` | YAML configuration for Aider |
6771

6872
## Tool details
6973

74+
### OpenCode
75+
76+
OpenCode receives full integration on par with Claude Code: dedicated skills in `.opencode/skills/`, slash commands in `.opencode/commands/`, and Starlark lint rules in `.claude/lint-rules/`. See the dedicated [OpenCode Integration](opencode.md) page for the complete walkthrough.
77+
78+
```bash
79+
mxcli init --tool opencode /path/to/project
80+
```
81+
7082
### Cursor
7183

7284
Cursor reads its instructions from `.cursorrules` in the project root. The file mxcli generates contains a compact MDL syntax reference and a list of mxcli commands the AI can use. Cursor's Composer and Chat features will reference this file automatically.

0 commit comments

Comments
 (0)