@maz-ui/mcp 5.2.0 → 5.3.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/dist/cli.mjs CHANGED
@@ -1,14 +1,8 @@
1
1
  import 'node:buffer';
2
2
  import 'node:path';
3
3
  import 'node:util';
4
- export { H as HELP, m as main, r as runCli, j as runInit, k as runReview } from './shared/mcp.D3_Fk0U3.mjs';
5
- import 'node:child_process';
6
- import 'node:process';
7
- import 'tty';
8
- import 'node:tty';
9
- import 'fs';
10
- import 'path';
11
- import 'url';
12
- import 'node:crypto';
4
+ export { H as HELP, m as main, r as runCli, j as runInit, k as runReview } from './shared/mcp.CXId5vdl.mjs';
13
5
  import 'node:fs';
14
6
  import 'node:url';
7
+ import 'node:crypto';
8
+ import 'node:process';
package/dist/index.d.mts CHANGED
@@ -373,6 +373,15 @@ interface SetupAgentsOptions {
373
373
  tool?: AgentsTool;
374
374
  /** Rules of the tool, required with another `tool` than maz-ui. Default: the maz-ui agent docs of `docsDir` */
375
375
  agentDocs?: AgentDocs;
376
+ /**
377
+ * Scope of the Claude Code rule, written as a `paths:` frontmatter so that Claude Code only loads it
378
+ * when it reads or edits a matching file, instead of at every session:
379
+ * - `'auto'` (default): the files of the workspaces whose `package.json` depends on one of `tool.packages`
380
+ * (e.g. `apps/pwa/**\/*.vue`), else the files of the project. No scope when the tool declares no `packages`
381
+ * - `'all'`: no scope, the rule is always loaded
382
+ * - globs, relative to `rootDir`: used as is
383
+ */
384
+ paths?: 'auto' | 'all' | string[];
376
385
  }
377
386
  interface McpServerCommand {
378
387
  command: string;
@@ -393,6 +402,8 @@ interface SetupAgentsResult {
393
402
  mcpServer: McpServerCommand;
394
403
  /** `false` when the server runs through `npx -y` because the project does not install the MCP package */
395
404
  localMcpServer: boolean;
405
+ /** Globs the Claude Code rule is scoped to (`paths:` frontmatter). `undefined`: the rule is always loaded, or not written */
406
+ claudeRulePaths?: string[];
396
407
  }
397
408
  /**
398
409
  * A tool whose AI agents are configured by `setupAgents`: maz-ui by default,
@@ -409,8 +420,29 @@ interface AgentsTool {
409
420
  mcpArgs?: string[];
410
421
  /** What generates the rules, written in their header (markdown, e.g. `` `npx relizy mcp init` ``) */
411
422
  generatedBy: string;
412
- /** Line written under the title of the rules. Default: `> <name> <version> is installed: these rules match this version.` */
413
- versionNote?: (version: string) => string;
423
+ /** Marker of the generated content, written in its header and used to recognize the files the tool owns. Default `Managed by <name>` */
424
+ marker?: string;
425
+ /**
426
+ * Line written under the title of the rules, `false` to write none.
427
+ * Default: `> <name> <version> is installed: these rules match this version.`
428
+ */
429
+ versionNote?: ((version: string) => string) | false;
430
+ /**
431
+ * Packages (or bins) of former MCP servers of the tool: an entry of the MCP config files that references one of
432
+ * them, when the tool has no entry yet, is replaced by the entry of the tool. Default: none
433
+ */
434
+ legacyMcpPackages?: string[];
435
+ /**
436
+ * Packages whose presence in the `dependencies`, `devDependencies`, `peerDependencies` or `optionalDependencies`
437
+ * of a `package.json` ties the files of its project to the tool (e.g. `['maz-ui', '@maz-ui/themes']`). Used by
438
+ * the `'auto'` scope of the Claude Code rule. Default: none, the rule is always loaded
439
+ */
440
+ packages?: string[];
441
+ /**
442
+ * Files of a project the rule applies to, relative to its folder. Default `['**\/*']` (the whole project).
443
+ * With `packages`, applied to each workspace that depends on one of them
444
+ */
445
+ ruleGlobs?: string[];
414
446
  }
415
447
  interface AgentDocs {
416
448
  directory: string;
package/dist/index.d.ts CHANGED
@@ -373,6 +373,15 @@ interface SetupAgentsOptions {
373
373
  tool?: AgentsTool;
374
374
  /** Rules of the tool, required with another `tool` than maz-ui. Default: the maz-ui agent docs of `docsDir` */
375
375
  agentDocs?: AgentDocs;
376
+ /**
377
+ * Scope of the Claude Code rule, written as a `paths:` frontmatter so that Claude Code only loads it
378
+ * when it reads or edits a matching file, instead of at every session:
379
+ * - `'auto'` (default): the files of the workspaces whose `package.json` depends on one of `tool.packages`
380
+ * (e.g. `apps/pwa/**\/*.vue`), else the files of the project. No scope when the tool declares no `packages`
381
+ * - `'all'`: no scope, the rule is always loaded
382
+ * - globs, relative to `rootDir`: used as is
383
+ */
384
+ paths?: 'auto' | 'all' | string[];
376
385
  }
377
386
  interface McpServerCommand {
378
387
  command: string;
@@ -393,6 +402,8 @@ interface SetupAgentsResult {
393
402
  mcpServer: McpServerCommand;
394
403
  /** `false` when the server runs through `npx -y` because the project does not install the MCP package */
395
404
  localMcpServer: boolean;
405
+ /** Globs the Claude Code rule is scoped to (`paths:` frontmatter). `undefined`: the rule is always loaded, or not written */
406
+ claudeRulePaths?: string[];
396
407
  }
397
408
  /**
398
409
  * A tool whose AI agents are configured by `setupAgents`: maz-ui by default,
@@ -409,8 +420,29 @@ interface AgentsTool {
409
420
  mcpArgs?: string[];
410
421
  /** What generates the rules, written in their header (markdown, e.g. `` `npx relizy mcp init` ``) */
411
422
  generatedBy: string;
412
- /** Line written under the title of the rules. Default: `> <name> <version> is installed: these rules match this version.` */
413
- versionNote?: (version: string) => string;
423
+ /** Marker of the generated content, written in its header and used to recognize the files the tool owns. Default `Managed by <name>` */
424
+ marker?: string;
425
+ /**
426
+ * Line written under the title of the rules, `false` to write none.
427
+ * Default: `> <name> <version> is installed: these rules match this version.`
428
+ */
429
+ versionNote?: ((version: string) => string) | false;
430
+ /**
431
+ * Packages (or bins) of former MCP servers of the tool: an entry of the MCP config files that references one of
432
+ * them, when the tool has no entry yet, is replaced by the entry of the tool. Default: none
433
+ */
434
+ legacyMcpPackages?: string[];
435
+ /**
436
+ * Packages whose presence in the `dependencies`, `devDependencies`, `peerDependencies` or `optionalDependencies`
437
+ * of a `package.json` ties the files of its project to the tool (e.g. `['maz-ui', '@maz-ui/themes']`). Used by
438
+ * the `'auto'` scope of the Claude Code rule. Default: none, the rule is always loaded
439
+ */
440
+ packages?: string[];
441
+ /**
442
+ * Files of a project the rule applies to, relative to its folder. Default `['**\/*']` (the whole project).
443
+ * With `packages`, applied to each workspace that depends on one of them
444
+ */
445
+ ruleGlobs?: string[];
414
446
  }
415
447
  interface AgentDocs {
416
448
  directory: string;
package/dist/index.mjs CHANGED
@@ -1,18 +1,15 @@
1
- export { D as DocSearch, K as Knowledge, T as TOOLS, b as buildInstructions, c as createContext, a as createMazUiMcpServer, f as findProjectMazUi, l as loadKnowledge, m as main, r as runCli, s as searchIcons, d as setupAgents, e as startStdioServer } from './shared/mcp.D3_Fk0U3.mjs';
1
+ export { D as DocSearch, K as Knowledge, T as TOOLS, b as buildInstructions, c as createContext, a as createMazUiMcpServer, f as findProjectMazUi, l as loadKnowledge, m as main, r as runCli, s as searchIcons, d as setupAgents, e as startStdioServer } from './shared/mcp.CXId5vdl.mjs';
2
2
  export { countBySeverity, filterBySeverity, formatFindings, reviewCode } from './chunks/index.mjs';
3
3
  export { reviewFiles } from './chunks/files.mjs';
4
4
  import 'node:buffer';
5
5
  import 'node:path';
6
6
  import 'node:util';
7
- import 'node:child_process';
7
+ import 'node:fs';
8
+ import 'node:url';
9
+ import 'node:crypto';
8
10
  import 'node:process';
9
- import 'tty';
10
- import 'node:tty';
11
+ import './shared/mcp.ByQS-5Nc.mjs';
11
12
  import 'fs';
12
13
  import 'path';
13
14
  import 'url';
14
- import 'node:crypto';
15
- import 'node:fs';
16
- import 'node:url';
17
- import './shared/mcp.Ccxm-Aoc.mjs';
18
15
  import 'module';
@@ -3,7 +3,7 @@ import { statSync, stat, realpathSync, realpath, readdirSync, readdir } from 'fs
3
3
  import { sep, basename, dirname, resolve, normalize, relative, posix, isAbsolute } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { createRequire } from 'module';
6
- import { g as getDefaultExportFromCjs } from './mcp.D3_Fk0U3.mjs';
6
+ import { g as getDefaultExportFromCjs } from './mcp.CXId5vdl.mjs';
7
7
 
8
8
  //#region rolldown:runtime
9
9
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
@@ -902,7 +902,7 @@ function requireScan () {
902
902
  const opts = options || {};
903
903
 
904
904
  const length = input.length - 1;
905
- const scanToEnd = opts.parts === true || opts.scanToEnd === true;
905
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
906
906
  const slashes = [];
907
907
  const tokens = [];
908
908
  const parts = [];
@@ -1036,15 +1036,21 @@ function requireScan () {
1036
1036
  }
1037
1037
 
1038
1038
  if (scanToEnd === true) {
1039
+ let parens = 0;
1040
+
1039
1041
  while (eos() !== true && (code = advance())) {
1040
1042
  if (code === CHAR_BACKWARD_SLASH) {
1041
1043
  backslashes = token.backslashes = true;
1042
- code = advance();
1044
+ advance();
1045
+ continue;
1046
+ }
1047
+
1048
+ if (code === CHAR_LEFT_PARENTHESES) {
1049
+ parens++;
1043
1050
  continue;
1044
1051
  }
1045
1052
 
1046
- if (code === CHAR_RIGHT_PARENTHESES) {
1047
- isGlob = token.isGlob = true;
1053
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
1048
1054
  finished = true;
1049
1055
  break;
1050
1056
  }
@@ -1109,14 +1115,21 @@ function requireScan () {
1109
1115
  isGlob = token.isGlob = true;
1110
1116
 
1111
1117
  if (scanToEnd === true) {
1118
+ let parens = 1;
1119
+
1112
1120
  while (eos() !== true && (code = advance())) {
1113
- if (code === CHAR_LEFT_PARENTHESES) {
1121
+ if (code === CHAR_BACKWARD_SLASH) {
1114
1122
  backslashes = token.backslashes = true;
1115
- code = advance();
1123
+ advance();
1124
+ continue;
1125
+ }
1126
+
1127
+ if (code === CHAR_LEFT_PARENTHESES) {
1128
+ parens++;
1116
1129
  continue;
1117
1130
  }
1118
1131
 
1119
- if (code === CHAR_RIGHT_PARENTHESES) {
1132
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
1120
1133
  finished = true;
1121
1134
  break;
1122
1135
  }
@@ -1203,7 +1216,7 @@ function requireScan () {
1203
1216
  let prevIndex;
1204
1217
 
1205
1218
  for (let idx = 0; idx < slashes.length; idx++) {
1206
- const n = prevIndex ? prevIndex + 1 : start;
1219
+ const n = prevIndex !== undefined ? prevIndex + 1 : start;
1207
1220
  const i = slashes[idx];
1208
1221
  const value = input.slice(n, i);
1209
1222
  if (opts.tokens) {
@@ -1216,21 +1229,20 @@ function requireScan () {
1216
1229
  depth(tokens[idx]);
1217
1230
  state.maxDepth += tokens[idx].depth;
1218
1231
  }
1219
- if (idx !== 0 || value !== '') {
1232
+ if (i >= start) {
1220
1233
  parts.push(value);
1234
+ prevIndex = i;
1221
1235
  }
1222
- prevIndex = i;
1223
1236
  }
1224
1237
 
1225
- if (prevIndex && prevIndex + 1 < input.length) {
1226
- const value = input.slice(prevIndex + 1);
1227
- parts.push(value);
1238
+ const n = prevIndex !== undefined ? prevIndex + 1 : start;
1239
+ const value = input.slice(n);
1240
+ parts.push(value);
1228
1241
 
1229
- if (opts.tokens) {
1230
- tokens[tokens.length - 1].value = value;
1231
- depth(tokens[tokens.length - 1]);
1232
- state.maxDepth += tokens[tokens.length - 1].depth;
1233
- }
1242
+ if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
1243
+ tokens[tokens.length - 1].value = value;
1244
+ depth(tokens[tokens.length - 1]);
1245
+ state.maxDepth += tokens[tokens.length - 1].depth;
1234
1246
  }
1235
1247
 
1236
1248
  state.slashes = slashes;
@@ -1481,7 +1493,15 @@ function requireParse () {
1481
1493
  }
1482
1494
  };
1483
1495
 
1484
- const getStarExtglobSequenceOutput = pattern => {
1496
+ const buildCharClassStar = chars => {
1497
+ const source = chars.length === 1
1498
+ ? utils.escapeRegex(chars[0])
1499
+ : `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
1500
+
1501
+ return `${source}*`;
1502
+ };
1503
+
1504
+ const getStarExtglobSequenceChars = pattern => {
1485
1505
  let index = 0;
1486
1506
  const chars = [];
1487
1507
 
@@ -1510,11 +1530,7 @@ function requireParse () {
1510
1530
  return;
1511
1531
  }
1512
1532
 
1513
- const source = chars.length === 1
1514
- ? utils.escapeRegex(chars[0])
1515
- : `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
1516
-
1517
- return `${source}*`;
1533
+ return chars;
1518
1534
  };
1519
1535
 
1520
1536
  const repeatedExtglobRecursion = pattern => {
@@ -1553,17 +1569,43 @@ function requireParse () {
1553
1569
  }
1554
1570
  }
1555
1571
 
1572
+ // A repeated extglob is "risky" (prone to catastrophic backtracking) when a
1573
+ // branch is itself a `*(...)` sequence, since that nests an unbounded quantifier
1574
+ // inside the outer `+(...)`/`*(...)`. When *every* branch reduces to single
1575
+ // characters we can emit one flat, ReDoS-safe character class that preserves the
1576
+ // meaning of ALL branches (e.g. `+(*(a)|*(b))` -> `[ab]*`), rather than dropping
1577
+ // every branch but the first.
1578
+ const safeChars = [];
1579
+ let sawStarSequence = false;
1580
+ let combinable = true;
1581
+
1556
1582
  for (const branch of branches) {
1557
- const safeOutput = getStarExtglobSequenceOutput(branch);
1558
- if (safeOutput) {
1559
- return { risky: true, safeOutput };
1583
+ const chars = getStarExtglobSequenceChars(branch);
1584
+ if (chars) {
1585
+ sawStarSequence = true;
1586
+ safeChars.push(...chars);
1587
+ continue;
1560
1588
  }
1561
1589
 
1590
+ const literal = normalizeSimpleBranch(branch);
1591
+ if (literal && literal.length === 1) {
1592
+ safeChars.push(literal);
1593
+ continue;
1594
+ }
1595
+
1596
+ combinable = false;
1597
+
1562
1598
  if (repeatedExtglobRecursion(branch) > max) {
1563
1599
  return { risky: true };
1564
1600
  }
1565
1601
  }
1566
1602
 
1603
+ if (sawStarSequence) {
1604
+ return combinable
1605
+ ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) }
1606
+ : { risky: true };
1607
+ }
1608
+
1567
1609
  return { risky: false };
1568
1610
  };
1569
1611
 
@@ -2396,6 +2438,15 @@ function requireParse () {
2396
2438
  consume('/**', 3);
2397
2439
  }
2398
2440
 
2441
+ // A globstar followed only by balanced closing parens is at the logical end of patterns like
2442
+ // `test(/utils/**)` and `test?(/utils/**)`. Treat it as EOS so the trailing `/**` can match its
2443
+ // parent path, except in negated extglobs where that would change the exclusion semantics.
2444
+ const isEnd = eos() || (
2445
+ state.parens > 0
2446
+ && rest === ')'.repeat(state.parens)
2447
+ && !extglobs.some(extglob => extglob.type === 'negate')
2448
+ );
2449
+
2399
2450
  if (prior.type === 'bos' && eos()) {
2400
2451
  prev.type = 'globstar';
2401
2452
  prev.value += value;
@@ -2406,7 +2457,7 @@ function requireParse () {
2406
2457
  continue;
2407
2458
  }
2408
2459
 
2409
- if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
2460
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && isEnd) {
2410
2461
  state.output = state.output.slice(0, -(prior.output + prev.output).length);
2411
2462
  prior.output = `(?:${prior.output}`;
2412
2463
 
@@ -2665,6 +2716,18 @@ function requirePicomatch$1 () {
2665
2716
  * const isMatch = picomatch('*.!(*a)');
2666
2717
  * console.log(isMatch('a.a')); //=> false
2667
2718
  * console.log(isMatch('a.b')); //=> true
2719
+ *
2720
+ * // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
2721
+ * const picomatch = require('picomatch/posix');
2722
+ * // the same API, defaulting to posix paths
2723
+ * const isMatch = picomatch('a/*');
2724
+ * console.log(isMatch('a\\b')); //=> false
2725
+ * console.log(isMatch('a/b')); //=> true
2726
+ *
2727
+ * // you can still configure the matcher function to accept windows paths
2728
+ * const isMatch = picomatch('a/*', { options: windows });
2729
+ * console.log(isMatch('a\\b')); //=> true
2730
+ * console.log(isMatch('a/b')); //=> true
2668
2731
  * ```
2669
2732
  * @name picomatch
2670
2733
  * @param {String|Array} `globs` One or more glob patterns.
@@ -2802,9 +2865,9 @@ function requirePicomatch$1 () {
2802
2865
  * @api public
2803
2866
  */
2804
2867
 
2805
- picomatch.matchBase = (input, glob, options) => {
2868
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
2806
2869
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
2807
- return regex.test(utils.basename(input));
2870
+ return regex.test(utils.basename(input, { windows: posix }));
2808
2871
  };
2809
2872
 
2810
2873
  /**