@maz-ui/nuxt 5.0.0 → 5.1.0-beta.0
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 +5 -0
- package/dist/module.d.mts +17 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +36 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -209,6 +209,11 @@ export default defineNuxtConfig({
|
|
|
209
209
|
vFullscreenImg: true,
|
|
210
210
|
vZoomImg: true,
|
|
211
211
|
},
|
|
212
|
+
|
|
213
|
+
// AI coding agents (default: { rules: false, mcp: true }, false to disable)
|
|
214
|
+
// In development, registers the maz-ui MCP server in the configs of the detected agents
|
|
215
|
+
// (.mcp.json, .cursor/mcp.json, .vscode/mcp.json), rules: true also writes .claude/rules/maz-ui.md and an AGENTS.md section
|
|
216
|
+
agents: { rules: false, mcp: true },
|
|
212
217
|
},
|
|
213
218
|
})
|
|
214
219
|
```
|
package/dist/module.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { AgentTarget } from '@maz-ui/node';
|
|
2
3
|
import { MazUiThemeOptions, ThemePreset, ThemePresetName } from '@maz-ui/themes';
|
|
3
4
|
import { MazUiTranslationsOptions } from '@maz-ui/translations';
|
|
4
5
|
import { MazUiDefaultsOptions } from 'maz-ui/composables/useGlobalConfig';
|
|
@@ -299,6 +300,21 @@ interface MazUiNuxtOptions {
|
|
|
299
300
|
*/
|
|
300
301
|
vTooltip?: boolean | VTooltipOptions;
|
|
301
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* AI coding agents integration
|
|
305
|
+
* @description Connects the AI coding agents detected in the project (Claude Code, Cursor, GitHub Copilot...) to maz-ui, in development only (never in CI or tests), version-matched with the installed maz-ui, without overwriting files you own.
|
|
306
|
+
* - `mcp`: registers the maz-ui MCP server in the agent configs (`.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`). Its instructions already give the maz-ui rules to the agents.
|
|
307
|
+
* - `rules`: also writes the maz-ui rules in `.claude/rules/maz-ui.md` and in a delimited section of `AGENTS.md` (for agents without MCP).
|
|
308
|
+
* - `targets`: agents to configure (`'claude'`, `'agents-md'`, `'cursor'`, `'vscode'`), default: the detected ones. Nothing is written when no agent is detected.
|
|
309
|
+
* - `true`: `{ mcp: true, rules: true }`, `false`: disabled
|
|
310
|
+
* @example `agents: { rules: true }` or `agents: false`
|
|
311
|
+
* @default { rules: false, mcp: true }
|
|
312
|
+
*/
|
|
313
|
+
agents?: boolean | {
|
|
314
|
+
targets?: AgentTarget[];
|
|
315
|
+
rules?: boolean;
|
|
316
|
+
mcp?: boolean;
|
|
317
|
+
};
|
|
302
318
|
}
|
|
303
319
|
|
|
304
320
|
declare module 'nuxt/schema' {
|
|
@@ -309,7 +325,7 @@ declare module 'nuxt/schema' {
|
|
|
309
325
|
mazUi: MazUiNuxtOptions;
|
|
310
326
|
}
|
|
311
327
|
interface PublicRuntimeConfig {
|
|
312
|
-
mazUi: Required<MazUiNuxtOptions
|
|
328
|
+
mazUi: Required<Omit<MazUiNuxtOptions, 'agents'>>;
|
|
313
329
|
}
|
|
314
330
|
}
|
|
315
331
|
declare const _default: _nuxt_schema.NuxtModule<MazUiNuxtOptions, MazUiNuxtOptions, false>;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { dirname } from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { detectAgentTargets, setupAgents } from '@maz-ui/node';
|
|
3
5
|
import { capitalize } from '@maz-ui/utils/helpers/capitalize';
|
|
6
|
+
import { getErrorMessage } from '@maz-ui/utils/helpers/getErrorMessage';
|
|
4
7
|
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
5
|
-
import { defineNuxtModule, createResolver, addPlugin, addComponent, addImports } from '@nuxt/kit';
|
|
8
|
+
import { defineNuxtModule, createResolver, addPlugin, addComponent, addImports, useLogger } from '@nuxt/kit';
|
|
6
9
|
import { defu } from 'defu';
|
|
7
10
|
|
|
8
11
|
const COMPONENT_NAMES = {
|
|
@@ -155,8 +158,38 @@ const defaults = {
|
|
|
155
158
|
vClickOutside: false,
|
|
156
159
|
vFullscreenImg: false,
|
|
157
160
|
vTooltip: false
|
|
161
|
+
},
|
|
162
|
+
agents: {
|
|
163
|
+
rules: false,
|
|
164
|
+
mcp: true
|
|
158
165
|
}
|
|
159
166
|
};
|
|
167
|
+
function syncAgents(agents, nuxt) {
|
|
168
|
+
if (!agents || !(nuxt.options.dev || nuxt.options._prepare) || process.env.CI || nuxt.options.test) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const logger = useLogger("maz-ui");
|
|
172
|
+
const isExplicit = nuxt.options.mazUi?.agents !== void 0;
|
|
173
|
+
try {
|
|
174
|
+
const { rootDir } = nuxt.options;
|
|
175
|
+
const { targets: requestedTargets, rules = true, mcp = true } = typeof agents === "object" ? agents : {};
|
|
176
|
+
const targets = requestedTargets ?? detectAgentTargets(rootDir);
|
|
177
|
+
if (targets.length === 0 || !rules && !mcp)
|
|
178
|
+
return;
|
|
179
|
+
const { changes } = setupAgents({ rootDir, targets, rules, mcp });
|
|
180
|
+
const applied = changes.filter((change) => ["create", "update", "remove"].includes(change.action));
|
|
181
|
+
if (applied.length > 0) {
|
|
182
|
+
const files = applied.map((change) => [change.file, `(${change.action})`].join(" "));
|
|
183
|
+
logger.info(`AI agents configured for maz-ui: ${files.join(", ")}`);
|
|
184
|
+
}
|
|
185
|
+
} catch (error) {
|
|
186
|
+
const message = `Could not configure the AI agents for maz-ui: ${getErrorMessage(error)}`;
|
|
187
|
+
if (isExplicit)
|
|
188
|
+
logger.warn(message);
|
|
189
|
+
else
|
|
190
|
+
logger.debug(message);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
160
193
|
function addMazUiComposableImport({
|
|
161
194
|
name,
|
|
162
195
|
from,
|
|
@@ -181,12 +214,13 @@ const module$1 = defineNuxtModule({
|
|
|
181
214
|
setup(options, nuxt) {
|
|
182
215
|
const { resolve } = createResolver(import.meta.url);
|
|
183
216
|
nuxt.options.build.transpile.push("maz-ui", "@maz-ui/themes", "@maz-ui/translations");
|
|
184
|
-
const moduleOptions = defu(
|
|
217
|
+
const { agents, ...moduleOptions } = defu(
|
|
185
218
|
nuxt.options.runtimeConfig.public.mazUi,
|
|
186
219
|
options,
|
|
187
220
|
defaults
|
|
188
221
|
);
|
|
189
222
|
nuxt.options.runtimeConfig.public.mazUi = moduleOptions;
|
|
223
|
+
syncAgents(agents, nuxt);
|
|
190
224
|
if (moduleOptions.css.injectCss) {
|
|
191
225
|
nuxt.options.css.unshift("maz-ui/style.css");
|
|
192
226
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.0",
|
|
4
|
+
"version": "5.1.0-beta.0",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -51,13 +51,14 @@
|
|
|
51
51
|
"nuxt": ">=3.4.0 <5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
+
"@maz-ui/node": "5.1.0-beta.0",
|
|
54
55
|
"@maz-ui/themes": "5.0.0",
|
|
55
56
|
"@maz-ui/translations": "5.0.0",
|
|
56
57
|
"@maz-ui/utils": "5.0.0",
|
|
57
58
|
"@nuxt/devtools-kit": "^3.4.4",
|
|
58
59
|
"@nuxt/kit": "^4.6.2",
|
|
59
60
|
"defu": "^6.1.7",
|
|
60
|
-
"maz-ui": "5.0.0"
|
|
61
|
+
"maz-ui": "5.1.0-beta.0"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@maz-ui/eslint-config": "5.0.0",
|