@maz-ui/mcp 5.1.0-beta.1 → 5.1.0-beta.2
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/dist/cli.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import 'node:path';
|
|
|
3
3
|
import 'node:util';
|
|
4
4
|
import '@maz-ui/node';
|
|
5
5
|
import '@maz-ui/utils/helpers/getErrorMessage';
|
|
6
|
-
export { H as HELP, m as main, i as runCli, k as runInit, n as runReview } from './shared/mcp.
|
|
6
|
+
export { H as HELP, m as main, i as runCli, k as runInit, n as runReview } from './shared/mcp.BFjMMLqy.mjs';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'node:url';
|
|
9
9
|
import 'zod';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DocSearch, K as Knowledge, T as TOOLS, b as buildInstructions, c as countBySeverity, a as createContext, d as createMazUiMcpServer, f as filterBySeverity, e as findProjectMazUi, g as formatFindings, l as loadKnowledge, m as main, r as reviewCode, h as reviewFiles, i as runCli, s as searchIcons, j as startStdioServer } from './shared/mcp.
|
|
1
|
+
export { D as DocSearch, K as Knowledge, T as TOOLS, b as buildInstructions, c as countBySeverity, a as createContext, d as createMazUiMcpServer, f as filterBySeverity, e as findProjectMazUi, g as formatFindings, l as loadKnowledge, m as main, r as reviewCode, h as reviewFiles, i as runCli, s as searchIcons, j as startStdioServer } from './shared/mcp.BFjMMLqy.mjs';
|
|
2
2
|
export { setupAgents } from '@maz-ui/node';
|
|
3
3
|
import 'node:buffer';
|
|
4
4
|
import 'node:path';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
-
import { join, dirname, resolve,
|
|
2
|
+
import { join, dirname, resolve, isAbsolute, relative } from 'node:path';
|
|
3
3
|
import { parseArgs } from 'node:util';
|
|
4
4
|
import { findProjectPackage, readPackageVersion, AGENT_TARGETS, detectAgentTargets, setupAgents } from '@maz-ui/node';
|
|
5
5
|
import { getErrorMessage } from '@maz-ui/utils/helpers/getErrorMessage';
|
|
@@ -454,7 +454,7 @@ const META_DOCS = /* @__PURE__ */ new Map([
|
|
|
454
454
|
["ecosystem/stylelint-config", /\b(?:stylelint|lint|linter|linting)\b/i],
|
|
455
455
|
["guide/migration-v5", /\b(?:migrat\w*|upgrad\w*|v4|v5|breaking)\b/i]
|
|
456
456
|
]);
|
|
457
|
-
const META_DOC_FACTOR = 0.
|
|
457
|
+
const META_DOC_FACTOR = 0.15;
|
|
458
458
|
const LOW_VALUE_TERMS = new Set(["add", "show", "display", "delete", "remove", "update", "set", "open", "close", "user", "users", "page", "item", "data", "value", "list", "text", "click", "between", "before", "after"].map((term) => processTerm(term) ?? term));
|
|
459
459
|
const LOW_VALUE_FACTOR = 0.4;
|
|
460
460
|
const LOW_VALUE_ONLY_FACTOR = 0.25;
|
|
@@ -796,7 +796,7 @@ function reportBlackWhite(token, utility, color, background, position, context)
|
|
|
796
796
|
rule: "theme-colors",
|
|
797
797
|
severity: "warning",
|
|
798
798
|
message: `\`${token}\` is a fixed color that does not follow the theme nor dark mode.`,
|
|
799
|
-
suggestion: color === "white" ? `Use \`${utility}-surface\` (backgrounds) or the \`-foreground\` of the color behind (\`text-primary-foreground\`).
|
|
799
|
+
suggestion: color === "white" ? `Use \`${utility}-surface\` (backgrounds) or the \`-foreground\` of the color behind (\`text-primary-foreground\`). Over media (image, video) or a fixed dark background, keep it with \`<!-- maz-ui-review-ignore theme-colors -- over the video -->\` above the element.` : `Use \`${utility}-foreground\` (text) or \`${utility}-contrast\`.`
|
|
800
800
|
}, position);
|
|
801
801
|
}
|
|
802
802
|
function checkClassList(value, offset, context, inherited) {
|
|
@@ -1639,7 +1639,8 @@ function ignoredRules(lines) {
|
|
|
1639
1639
|
const byLine = /* @__PURE__ */ new Map();
|
|
1640
1640
|
let file;
|
|
1641
1641
|
const parseRules = (rest) => {
|
|
1642
|
-
const
|
|
1642
|
+
const [directive] = rest.replace(/-->|\*\/|\*\}|\}/g, "").split(/\s--\s/);
|
|
1643
|
+
const rules = directive.split(/[\s,]+/).filter((rule) => /^[a-z][a-z\d-]+$/.test(rule));
|
|
1643
1644
|
return rules.length > 0 ? new Set(rules) : "all";
|
|
1644
1645
|
};
|
|
1645
1646
|
for (const [index, line] of lines.entries()) {
|
|
@@ -1767,12 +1768,16 @@ async function expandPaths(patterns, cwd) {
|
|
|
1767
1768
|
}
|
|
1768
1769
|
return [...files].filter((file) => REVIEWABLE_EXTENSIONS.includes(file.split(".").pop() ?? "")).sort();
|
|
1769
1770
|
}
|
|
1771
|
+
function displayPath(cwd, file) {
|
|
1772
|
+
const path = relative(cwd, file);
|
|
1773
|
+
return path && !path.startsWith("..") && !isAbsolute(path) ? path : file;
|
|
1774
|
+
}
|
|
1770
1775
|
async function reviewFiles(patterns, { knowledge, cwd, framework, minSeverity = "info" }) {
|
|
1771
1776
|
const files = await expandPaths(patterns, cwd);
|
|
1772
1777
|
return {
|
|
1773
1778
|
truncated: files.length > MAX_REVIEWED_FILES,
|
|
1774
1779
|
reviews: files.slice(0, MAX_REVIEWED_FILES).map((file) => ({
|
|
1775
|
-
file:
|
|
1780
|
+
file: displayPath(cwd, file),
|
|
1776
1781
|
findings: filterBySeverity(
|
|
1777
1782
|
reviewCode(readFileSync(file, "utf8"), { knowledge, filename: file, framework: framework ?? detectFramework(dirname(file)) }),
|
|
1778
1783
|
minSeverity
|
|
@@ -2878,7 +2883,7 @@ async function runReview(values, positionals, cwd) {
|
|
|
2878
2883
|
return 0;
|
|
2879
2884
|
console.error(`${formatFindings(findings, reviews2[0].file)}
|
|
2880
2885
|
|
|
2881
|
-
Fix these maz-ui issues (see the maz-ui MCP tools), or add a \`maz-ui-review-ignore <rule>\` comment above the line when it is intended.`);
|
|
2886
|
+
Fix these maz-ui issues (see the maz-ui MCP tools), or add a \`maz-ui-review-ignore <rule> -- <reason>\` comment above the line when it is intended.`);
|
|
2882
2887
|
return 2;
|
|
2883
2888
|
}
|
|
2884
2889
|
if (positionals.length === 0) {
|
package/docs/guide/ai-agents.md
CHANGED
|
@@ -141,6 +141,25 @@ The maz-ui plugin bundles the MCP server, a `maz-ui` skill (rules and workflow)
|
|
|
141
141
|
|
|
142
142
|
The plugin works in every project, `init` configures one project for your whole team: use both or either.
|
|
143
143
|
|
|
144
|
+
### Review hook without the plugin
|
|
145
|
+
|
|
146
|
+
The review hook of the plugin is the `review --hook` mode of the CLI. To use it alone, add it to `.claude/settings.json` (shared with your team) or `.claude/settings.local.json` (your machine only):
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"hooks": {
|
|
151
|
+
"PostToolUse": [
|
|
152
|
+
{
|
|
153
|
+
"matcher": "Edit|Write|MultiEdit",
|
|
154
|
+
"hooks": [{ "type": "command", "command": "npx -y @maz-ui/mcp@latest review --hook", "timeout": 90 }]
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Each file Claude edits is reviewed; the errors and warnings are sent back to Claude, which fixes them.
|
|
162
|
+
|
|
144
163
|
## Code review in CI
|
|
145
164
|
|
|
146
165
|
The checks of `review_code` are also available from the command line:
|
|
@@ -173,7 +192,7 @@ The command exits with an error code when it finds errors (or more warnings than
|
|
|
173
192
|
| `root-import`, `internal-import` | error | Runtime imports from `maz-ui` (types only) or from `src`/`dist` |
|
|
174
193
|
| `nuxt-auto-import` | info | Imports that `@maz-ui/nuxt` already auto-imports |
|
|
175
194
|
|
|
176
|
-
When something is intended, ignore it with a comment on the line above (`<!-- maz-ui-review-ignore prefer-maz-component -->`, `// maz-ui-review-ignore theme-colors`), or `maz-ui-review-ignore-file` for a whole file.
|
|
195
|
+
When something is intended, ignore it with a comment on the line above (`<!-- maz-ui-review-ignore prefer-maz-component -->`, `// maz-ui-review-ignore theme-colors`), or `maz-ui-review-ignore-file` for a whole file. Give the reason after `--`: `<!-- maz-ui-review-ignore theme-colors -- frame over the video -->`.
|
|
177
196
|
|
|
178
197
|
## llms.txt
|
|
179
198
|
|