agents-mdx 0.0.1 β 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -0
- package/dist/index.js +6 -1
- package/package.json +18 -7
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# AGENTS.mdx
|
|
2
|
+
|
|
3
|
+
**One source of truth for all your AI coding agents.**
|
|
4
|
+
|
|
5
|
+
Stop copy-pasting guidelines between `CLAUDE.md`, `AGENTS.md`, and other agent config files. Write your conventions once in composable [MDX](https://mdxjs.com/) components, and let `agents-mdx` generate the right files for Claude Code, Cursor, Copilot, Codex, and more.
|
|
6
|
+
|
|
7
|
+
## Why agents-mdx?
|
|
8
|
+
|
|
9
|
+
- π§© **Composable** β Break down conventions into reusable [MDX](https://mdxjs.com/) components
|
|
10
|
+
- π **Multi-agent** β Generate config files for multiple AI agents from a single source
|
|
11
|
+
- π **MCP support** β Define MCP servers once, generate configs for all agents
|
|
12
|
+
- π₯ **Team-friendly** β Self-serve onboarding lets developers pick the conventions they need
|
|
13
|
+
- β‘ **Live reload** β Watch mode rebuilds on every change
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install agents-mdx
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### 1. Create your conventions
|
|
24
|
+
|
|
25
|
+
Organize your team's guidelines as MDX files in a `conventions/` directory:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
your-project/
|
|
29
|
+
βββ conventions/
|
|
30
|
+
β βββ code-style.mdx
|
|
31
|
+
β βββ testing.mdx
|
|
32
|
+
β βββ git-workflow.mdx
|
|
33
|
+
β βββ security.mdx
|
|
34
|
+
β βββ react-patterns.mdx
|
|
35
|
+
βββ AGENTS.mdx # β generated by setup, configurable by each dev on your team
|
|
36
|
+
βββ CLAUDE.md # β symlink, auto-generated
|
|
37
|
+
βββ AGENTS.md # β symlink, auto-generated
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Each convention file is a standard MDX file:
|
|
41
|
+
|
|
42
|
+
```md
|
|
43
|
+
# Code Style
|
|
44
|
+
|
|
45
|
+
- Use TypeScript strict mode
|
|
46
|
+
- Prefer `const` over `let`
|
|
47
|
+
- Use early returns to reduce nesting
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 2. Run setup
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx agents-mdx setup
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This interactive wizard will:
|
|
57
|
+
|
|
58
|
+
- Ask which AI agents you use (Claude Code, Cursor, Copilot, etc.)
|
|
59
|
+
- Let you pick which conventions to include
|
|
60
|
+
- Generate an `AGENTS.mdx` file that imports your conventions
|
|
61
|
+
- Create `CLAUDE.md` / `AGENTS.md` files
|
|
62
|
+
- Add `AGENTS.mdx`, `CLAUDE.md` and `AGENTS.md` to your `.gitignore`
|
|
63
|
+
|
|
64
|
+
### 3. Watch for changes
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx agents-mdx start
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This watches your `AGENTS.mdx` and all imported conventions, regenerating the output files on every save.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## CI
|
|
74
|
+
|
|
75
|
+
For CI environments like [claude-code-action](https://github.com/anthropics/claude-code-action), use the non-interactive flags to generate files automatically:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx agents-mdx setup --force --agents claude-code --all-conventions
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**All options:**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx agents-mdx setup [path]
|
|
85
|
+
--force # Overwrite existing files without prompting
|
|
86
|
+
--agents # Pre-select agents: claude-code, cursor, copilot, codex, open-code
|
|
87
|
+
--conventions # Custom conventions directory (default: "conventions")
|
|
88
|
+
--all-conventions # Include all conventions without prompting
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## How It Works
|
|
92
|
+
|
|
93
|
+
The `AGENTS.mdx` file is git-ignored, so each developer can customize which conventions they want active. Your team commits the shared `conventions/` folder, but individuals choose what to include.
|
|
94
|
+
|
|
95
|
+
Your `AGENTS.mdx` file imports conventions as components:
|
|
96
|
+
|
|
97
|
+
```mdx
|
|
98
|
+
import { defineConfig } from '@agents-mdx/runtime/config';
|
|
99
|
+
import CodeStyle from './conventions/code-style.mdx';
|
|
100
|
+
import Testing from './conventions/testing.mdx';
|
|
101
|
+
|
|
102
|
+
export const config = defineConfig({
|
|
103
|
+
agents: ['claude-code', 'codex', 'copilot'],
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
# Project Guidelines
|
|
107
|
+
|
|
108
|
+
<CodeStyle config={config} />
|
|
109
|
+
<Testing config={config} />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Running `start` compiles this into `CLAUDE.md` and `AGENTS.md` β symlinked files that your AI agents read automatically.
|
|
113
|
+
|
|
114
|
+
## MCP Servers
|
|
115
|
+
|
|
116
|
+
Define MCP servers in your convention files and let `agents-mdx` generate the right config format for each agent.
|
|
117
|
+
|
|
118
|
+
Environment variables are automatically transformed to each agent's format (`${env:VAR}` for Cursor, `${VAR}` for Claude Code).
|
|
119
|
+
|
|
120
|
+
**In your convention file (`conventions/mcp-tools.mdx`):**
|
|
121
|
+
|
|
122
|
+
```mdx
|
|
123
|
+
export const mcpServers = {
|
|
124
|
+
'supabase-local': {
|
|
125
|
+
url: 'http://localhost:54321/mcp'
|
|
126
|
+
},
|
|
127
|
+
'supabase-staging': {
|
|
128
|
+
url: 'https://mcp.supabase.com/mcp?project_ref=${env:SUPABASE_PROJECT_REF}',
|
|
129
|
+
headers: {
|
|
130
|
+
Authorization: 'Bearer ${env:SUPABASE_ACCESS_TOKEN}'
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
## Database tables
|
|
136
|
+
|
|
137
|
+
- Always ensure new tables have a `created_at`, `updated_at` and `deleted_at` columns
|
|
138
|
+
|
|
139
|
+
## Database operations
|
|
140
|
+
|
|
141
|
+
- Always soft deleted entries
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**During setup**, you'll be prompted to select which MCP servers to enable. The `start` command then generates the appropriate config files:
|
|
145
|
+
|
|
146
|
+
- **Cursor** β `.cursor/mcp.json`
|
|
147
|
+
- **Claude Code** β `.mcp.json`
|
|
148
|
+
- **VSCode** β `.vscode/mcp.json`
|
|
149
|
+
|
|
150
|
+
## Conditional Instructions
|
|
151
|
+
|
|
152
|
+
Include or exclude content based on the environment. Import `env` from the runtime:
|
|
153
|
+
|
|
154
|
+
```mdx
|
|
155
|
+
import { env } from '@agents-mdx/runtime/env';
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**What's available:**
|
|
159
|
+
|
|
160
|
+
- `env.CI` β detect GitHub Actions, useful for [claude-code-action](https://github.com/anthropics/claude-code-action) reviews
|
|
161
|
+
- `env.hasExecutable('tool')` β check if a CLI tool is installed
|
|
162
|
+
- `env.isClaudeMd` / `env.isAgentsMd` β check which output file is being generated
|
|
163
|
+
|
|
164
|
+
**Example: tool-specific instructions**
|
|
165
|
+
|
|
166
|
+
Only include instructions for [`ck`](https://github.com/nicholasgriffintn/ck) when it's installed:
|
|
167
|
+
|
|
168
|
+
```mdx
|
|
169
|
+
import { env } from '@agents-mdx/runtime/env';
|
|
170
|
+
|
|
171
|
+
{(() => {
|
|
172
|
+
if (!env.hasExecutable('ck')) {
|
|
173
|
+
throw 'ignore-file';
|
|
174
|
+
}
|
|
175
|
+
})()}
|
|
176
|
+
|
|
177
|
+
## Semantic Search
|
|
178
|
+
|
|
179
|
+
Use `ck` to find related code even without exact keywords:
|
|
180
|
+
|
|
181
|
+
\`\`\`bash
|
|
182
|
+
ck --sem "retry logic"
|
|
183
|
+
\`\`\`
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
MIT
|
|
190
|
+
|
|
191
|
+
Copyright (c) 2026βpresent [StackBlitz][stackblitz]
|
|
192
|
+
|
|
193
|
+
[stackblitz]: https://stackblitz.com/
|
package/dist/index.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const agentsMdxEntryPoint = require.resolve('@agents-mdx/cli');
|
|
6
|
+
spawnSync('node', [agentsMdxEntryPoint, ...process.argv.slice(2)], { stdio: 'inherit' });
|
package/package.json
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agents-mdx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Nemikolh",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"bugs": "https://github.com/stackblitz/agents
|
|
8
|
-
"homepage": "https://github.com/stackblitz/agents
|
|
7
|
+
"bugs": "https://github.com/stackblitz/agents.mdx/issues",
|
|
8
|
+
"homepage": "https://github.com/stackblitz/agents.mdx",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/stackblitz/agents
|
|
12
|
-
"directory": "packages/agents-mdx
|
|
11
|
+
"url": "git+https://github.com/stackblitz/agents.mdx.git",
|
|
12
|
+
"directory": "packages/agents-mdx"
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
15
15
|
"agents-mdx": "dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
|
-
]
|
|
20
|
-
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^22.15.21",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@agents-mdx/cli": "0.0.3"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"typecheck": "tsc --noEmit"
|
|
30
|
+
}
|
|
31
|
+
}
|