Skip to content

Commit 635d737

Browse files
akoclaude
andcommitted
feat: add first-class GitHub Copilot support to mxcli init
Register 'copilot' in SupportedTools so 'mxcli init --tool copilot' generates .github/copilot-instructions.md — Copilot's project-level instructions file that VS Code automatically loads. The generated file is compact (Copilot has a smaller instruction context window than Claude Code) and includes: - Critical ./mxcli (not mxcli) rule - Quick command examples (SHOW STRUCTURE, check, exec, search) - MDL syntax reminders (entities, microflow vars, page widgets) - Pointers to AGENTS.md and .ai-context/skills/ for full reference Also works with 'mxcli add-tool copilot' for existing projects. Closes #183 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ee4c037 commit 635d737

File tree

5 files changed

+63
-6
lines changed

5 files changed

+63
-6
lines changed

cmd/mxcli/cmd_add_tool.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Supported Tools:
3737
- windsurf Windsurf (Codeium) with MDL rules
3838
- aider Aider with project configuration
3939
- opencode OpenCode AI agent with MDL commands and skills
40+
- vibe Mistral Vibe CLI agent with skills
41+
- copilot GitHub Copilot with project-level instructions
4042
`,
4143
Args: cobra.RangeArgs(0, 2),
4244
Run: func(cmd *cobra.Command, args []string) {

cmd/mxcli/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Supported Tools:
8888
- aider Aider with project configuration
8989
- opencode OpenCode AI agent with MDL commands and skills
9090
- vibe Mistral Vibe CLI agent with skills
91+
- copilot GitHub Copilot with project-level instructions
9192
9293
All tools receive universal documentation in AGENTS.md and .ai-context/
9394

cmd/mxcli/tool_templates.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ var SupportedTools = map[string]ToolConfig{
104104
},
105105
// Skills are synced dynamically from the embedded skillsFS in init.go
106106
},
107+
"copilot": {
108+
Name: "GitHub Copilot",
109+
Description: "GitHub Copilot with project-level instructions",
110+
Files: []ToolFile{
111+
{
112+
Path: ".github/copilot-instructions.md",
113+
Content: generateCopilotInstructions,
114+
},
115+
},
116+
},
107117
}
108118

109119
// Universal files created for all tools
@@ -447,6 +457,50 @@ allowed-tools:
447457
return []byte(frontmatter + string(content))
448458
}
449459

460+
// generateCopilotInstructions creates .github/copilot-instructions.md, the
461+
// project-level instructions file automatically loaded by GitHub Copilot in VS Code.
462+
// Kept compact since Copilot's instruction context window is smaller than Claude Code's.
463+
func generateCopilotInstructions(projectName, mprPath string) string {
464+
mprFile := filepath.Base(mprPath)
465+
return fmt.Sprintf("# Mendix MDL Project: %s\n\n"+
466+
"This project uses **mxcli** to read and modify Mendix model files (`.mpr`) via MDL "+
467+
"(Mendix Definition Language) — a SQL-like text format for Mendix applications.\n\n"+
468+
"## Critical: mxcli Location\n\n"+
469+
"The mxcli binary is in the **project root**, not on PATH:\n"+
470+
"- ✅ `./mxcli ...`\n"+
471+
"- ❌ `mxcli ...` (will fail)\n\n"+
472+
"MPR file: `%s`\n\n"+
473+
"## Quick Commands\n\n"+
474+
"```bash\n"+
475+
"# Explore project structure\n"+
476+
"./mxcli -p %s -c \"SHOW STRUCTURE\"\n\n"+
477+
"# Validate an MDL script (always do this before executing)\n"+
478+
"./mxcli check script.mdl -p %s --references\n\n"+
479+
"# Execute an MDL script\n"+
480+
"./mxcli exec script.mdl -p %s\n\n"+
481+
"# Search the project\n"+
482+
"./mxcli search -p %s \"keyword\"\n"+
483+
"```\n\n"+
484+
"## Where to Look First\n\n"+
485+
"- **`AGENTS.md`** — full mxcli reference, MDL command list, workflow examples.\n"+
486+
"- **`.ai-context/skills/`** — focused syntax guides for microflows, pages, "+
487+
"domain models, security, etc. **Read the relevant skill before writing MDL.**\n\n"+
488+
"## MDL Syntax Reminders\n\n"+
489+
"- **Entities:** `CREATE PERSISTENT ENTITY Mod.Customer (Name: String(200), Age: Integer);`\n"+
490+
"- **Microflow variables:** start with `$` (e.g., `$Customer`, `$List`).\n"+
491+
"- **Page widgets:** nest with `{ }`, properties use `(Key: value, ...)`.\n"+
492+
"- **Single quotes in expressions:** escape by doubling — `'it''s here'`.\n"+
493+
"- **No `AS` keyword** in entity attribute declarations.\n"+
494+
"- **Statements** end with `;` or `/` on a line by itself.\n\n"+
495+
"## Workflow\n\n"+
496+
"1. Explore: read `AGENTS.md` and the relevant `.ai-context/skills/` file first.\n"+
497+
"2. Write MDL in a `.mdl` file.\n"+
498+
"3. Validate: `./mxcli check <file>.mdl -p %s --references`.\n"+
499+
"4. Execute: `./mxcli exec <file>.mdl -p %s`.\n"+
500+
"5. Verify: `./mxcli -p %s -c \"DESCRIBE ENTITY Mod.Name\"`.\n",
501+
projectName, mprFile, mprFile, mprFile, mprFile, mprFile, mprFile, mprFile, mprFile)
502+
}
503+
450504
func generateOpenCodeConfig(projectName, mprPath string) string {
451505
return `{
452506
"$schema": "https://opencode.ai/config.json",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ mxcli init --list-tools
5252
| **Windsurf** | `--tool windsurf` | `.windsurfrules` |
5353
| **Aider** | `--tool aider` | `.aider.conf.yml` |
5454
| **Mistral Vibe** | `--tool vibe` | `.vibe/config.toml`, `.vibe/prompts/`, `.vibe/skills/` |
55+
| **GitHub Copilot** | `--tool copilot` | `.github/copilot-instructions.md` |
5556

5657
All tools also receive the universal files (`AGENTS.md`, `.ai-context/`).
5758

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ On top of the universal files, each tool gets its own configuration:
6767
|------|-------------|----------|
6868
| **Claude Code** | `.claude/`, `CLAUDE.md` | Settings, skills, commands, lint rules, project context |
6969
| **OpenCode** | `.opencode/`, `opencode.json` | Skills, commands, lint rules, project context |
70-
| **GitHub Copilot** | `AGENTS.md` | Reads universal context automatically via VS Code |
70+
| **GitHub Copilot** | `.github/copilot-instructions.md`, `AGENTS.md` | Project-level instructions auto-loaded by Copilot in VS Code |
7171
| **Cursor** | `.cursorrules` | Compact MDL reference and mxcli command guide |
7272
| **Continue.dev** | `.continue/config.json` | Custom commands and slash commands |
7373
| **Windsurf** | `.windsurfrules` | MDL rules for Codeium's AI |
@@ -86,16 +86,15 @@ mxcli init --tool opencode /path/to/project
8686

8787
### GitHub Copilot
8888

89-
GitHub Copilot works with mxcli out of the box via the universal `AGENTS.md` file — no dedicated `--tool` flag is needed. Copilot's agent mode in VS Code automatically reads markdown files in the project root, so after running `mxcli init`, Copilot has access to the full MDL reference and skill files.
89+
GitHub Copilot has dedicated support via `--tool copilot`, which generates `.github/copilot-instructions.md` — Copilot's project-level instructions file that's automatically loaded in VS Code.
9090

9191
```bash
92-
# Any mxcli init creates AGENTS.md, which Copilot reads automatically
93-
mxcli init /path/to/project
92+
mxcli init --tool copilot /path/to/project
9493
```
9594

96-
For many organizations, Copilot is the default AI assistant as part of their Microsoft/GitHub enterprise agreement. mxcli supports this by ensuring the universal files (`AGENTS.md`, `.ai-context/skills/`) provide enough context for Copilot to work effectively with MDL.
95+
The generated file is compact (Copilot has a smaller instruction context window than Claude Code) and points to `AGENTS.md` and `.ai-context/skills/` for full reference material. It includes the critical `./mxcli` (not `mxcli`) rule, quick command examples, and MDL syntax reminders.
9796

98-
To use: open the project in VS Code with the GitHub Copilot extension, open Copilot Chat (Ctrl+Shift+I), and ask for Mendix changes. Copilot will reference `AGENTS.md` and the skill files for MDL syntax guidance.
97+
For many organizations, Copilot is the default AI assistant as part of their Microsoft/GitHub enterprise agreement. To use: open the project in VS Code with the GitHub Copilot extension, open Copilot Chat (Ctrl+Shift+I), and ask for Mendix changes. Copilot will reference `.github/copilot-instructions.md`, `AGENTS.md`, and the skill files for MDL syntax guidance.
9998

10099
### Cursor
101100

0 commit comments

Comments
 (0)