@maz-ui/node 5.2.0-beta.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/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as consola from 'consola';
3
3
  import { ConsolaOptions, InputLogObject, ConsolaReporter, ConsolaInstance } from 'consola';
4
4
  export { ConsolaOptions } from 'consola';
5
5
  import { FigletOptions } from 'figlet/node';
6
+ export { AGENTS_MD_BEGIN, AGENTS_MD_END, AGENT_TARGETS, AgentDocs, AgentTarget, AgentsTool, DEFAULT_MCP_SERVER, MANAGED_MARKER, MAZ_UI_AGENTS_TOOL, MCP_SERVER_NAME, McpServerCommand, PackageManager, SetupAgentsAction, SetupAgentsChange, SetupAgentsOptions, SetupAgentsResult, compareVersions, detectAgentTargets, detectPackageManager, findInstalledPackage, findProjectPackage, findWorkspaceDirs, findWorkspacesUsing, installsMcpPackage, isEditedManagedContent, mcpServerCommand, readAgentDocs, readManagedVersion, readPackageVersion, readWorkspacePatterns, resolveRulePaths, setupAgents, writeFileAtomic } from './agents.js';
6
7
 
7
8
  declare const LogLevelMap: {
8
9
  silent: number;
@@ -168,152 +169,5 @@ declare function redactSecrets(input: string): string;
168
169
  */
169
170
  declare function redactError<T>(error: T): T;
170
171
 
171
- /**
172
- * AI coding agents supported by `setupAgents`.
173
- *
174
- * - `claude`: Claude Code rule (`.claude/rules/<tool>.md`) and MCP server (`.mcp.json`)
175
- * - `agents-md`: section in `AGENTS.md` (Codex, Cursor, Copilot, Windsurf, Zed, Gemini...)
176
- * - `cursor`: MCP server in `.cursor/mcp.json` (rules come from `AGENTS.md`)
177
- * - `vscode`: MCP server in `.vscode/mcp.json` for GitHub Copilot (rules come from `AGENTS.md`)
178
- */
179
- type AgentTarget = 'claude' | 'agents-md' | 'cursor' | 'vscode';
180
- declare const AGENT_TARGETS: AgentTarget[];
181
- interface SetupAgentsOptions {
182
- /** Root of the project (where `AGENTS.md`, `.claude/`, `.mcp.json` live) */
183
- rootDir: string;
184
- /** Agents to configure. Default: the agents detected in the project */
185
- targets?: AgentTarget[];
186
- /** Write the rules of the tool (Claude Code rule, `AGENTS.md` section). Default `true` */
187
- rules?: boolean;
188
- /** Register the MCP server of the tool. Default `true` */
189
- mcp?: boolean;
190
- /** Compute the changes without writing anything */
191
- dryRun?: boolean;
192
- /** Remove everything `setupAgents` added */
193
- remove?: boolean;
194
- /** Folder of the maz-ui agent docs. Default: `docs/` of the maz-ui package installed in `rootDir` */
195
- docsDir?: string;
196
- /** Command used to start the MCP server. Default: `mcpServerCommand(rootDir, mcpVersion, tool)` */
197
- mcpServer?: McpServerCommand;
198
- /** Version of the MCP package pinned in the `npx -y` command, when the project does not install it. Default `latest` */
199
- mcpVersion?: string;
200
- /** Tool whose agents are configured. Default: maz-ui (`MAZ_UI_AGENTS_TOOL`) */
201
- tool?: AgentsTool;
202
- /** Rules of the tool, required with another `tool` than maz-ui. Default: the maz-ui agent docs of `docsDir` */
203
- agentDocs?: AgentDocs;
204
- }
205
- interface McpServerCommand {
206
- command: string;
207
- args: string[];
208
- }
209
- type SetupAgentsAction = 'create' | 'update' | 'remove' | 'unchanged' | 'skip';
210
- interface SetupAgentsChange {
211
- /** Path relative to `rootDir` */
212
- file: string;
213
- action: SetupAgentsAction;
214
- reason?: string;
215
- }
216
- interface SetupAgentsResult {
217
- targets: AgentTarget[];
218
- version: string;
219
- changes: SetupAgentsChange[];
220
- /** Command registered in the MCP config files */
221
- mcpServer: McpServerCommand;
222
- /** `false` when the server runs through `npx -y` because the project does not install the MCP package */
223
- localMcpServer: boolean;
224
- }
225
- declare const MANAGED_MARKER = "Managed by maz-ui";
226
- declare const AGENTS_MD_BEGIN = "<!-- BEGIN:maz-ui -->";
227
- declare const AGENTS_MD_END = "<!-- END:maz-ui -->";
228
- declare const MCP_SERVER_NAME = "maz-ui";
229
- declare const DEFAULT_MCP_SERVER: McpServerCommand;
230
- /**
231
- * A tool whose AI agents are configured by `setupAgents`: maz-ui by default,
232
- * or another package that ships its own MCP server and rules.
233
- */
234
- interface AgentsTool {
235
- /** Name of the tool: key of its MCP server, `.claude/rules/<name>.md` and markers of the generated content */
236
- name: string;
237
- /** Package that ships the MCP server */
238
- mcpPackage: string;
239
- /** Bin of `mcpPackage` that starts the MCP server */
240
- mcpBin: string;
241
- /** Arguments of `mcpBin` that start the MCP server (e.g. `['mcp']`). Default `[]` */
242
- mcpArgs?: string[];
243
- /** What generates the rules, written in their header (markdown, e.g. `` `npx relizy mcp init` ``) */
244
- generatedBy: string;
245
- /** Line written under the title of the rules. Default: `> <name> <version> is installed: these rules match this version.` */
246
- versionNote?: (version: string) => string;
247
- }
248
- declare const MAZ_UI_AGENTS_TOOL: AgentsTool;
249
- type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';
250
- /** `true` when the `package.json` of the project declares the MCP package of the tool (`@maz-ui/mcp` by default) */
251
- declare function installsMcpPackage(rootDir: string, tool?: AgentsTool): boolean;
252
- /** Package manager of a project: the `packageManager` field, else its lockfile */
253
- declare function detectPackageManager(rootDir: string): PackageManager;
254
- /**
255
- * Command of the MCP server of a tool (maz-ui by default) for a project. When
256
- * the project installs its package, the package manager starts the installed
257
- * version in about a second, at the version of the lockfile. Otherwise
258
- * `npx -y` downloads it, pinned to `version`: a dist-tag (`latest`) makes npx
259
- * query the registry at every start, which can exceed the start timeout of the
260
- * agents behind a slow registry.
261
- */
262
- declare function mcpServerCommand(rootDir: string, version?: string, tool?: AgentsTool): McpServerCommand;
263
- /**
264
- * `true` when generated rules were edited by hand since they were written:
265
- * they are kept, a newer version of the rules would overwrite the edits.
266
- */
267
- declare function isEditedManagedContent(content: string | undefined, tool?: AgentsTool): boolean;
268
- /** Detects the AI agents configured in a project */
269
- declare function detectAgentTargets(rootDir: string): AgentTarget[];
270
- interface AgentDocs {
271
- directory: string;
272
- version: string;
273
- claudeRule: string;
274
- agentsMdSection: string;
275
- }
276
- /**
277
- * Finds `node_modules/<name>` from a directory up to the filesystem root, like
278
- * the Node resolution but without the global folders (`NODE_PATH`), so only a
279
- * package installed for the project is found.
280
- */
281
- declare function findInstalledPackage(fromDir: string, name: string): string | undefined;
282
- /** Version of an installed package, read from its `package.json` */
283
- declare function readPackageVersion(packageDir: string): string | undefined;
284
- /**
285
- * Workspace patterns of a monorepo: the `packages` of `pnpm-workspace.yaml`,
286
- * else the `workspaces` of `package.json` (npm, yarn, bun), else `apps/*` and
287
- * `packages/*`. Negated patterns are ignored.
288
- */
289
- declare function readWorkspacePatterns(rootDir: string): string[];
290
- /** Folders of the workspaces of a monorepo, in the order of the patterns. Only the fixed part of each pattern is read (`apps/*` reads `apps`) */
291
- declare function findWorkspaceDirs(rootDir: string): string[];
292
- /**
293
- * Finds a package installed in a project: in the `node_modules` of the
294
- * project root and of its workspaces (monorepos without hoisting), then in
295
- * the parent folders.
296
- */
297
- declare function findProjectPackage(rootDir: string, name: string): string | undefined;
298
- /** Reads the agent files shipped in `maz-ui/docs/agents` */
299
- declare function readAgentDocs(rootDir: string, docsDir?: string): AgentDocs;
300
- /**
301
- * Writes a temporary file then renames it: a concurrent reader (several Nuxt
302
- * apps of a monorepo starting together) sees the old or the new file, never a
303
- * truncated one.
304
- */
305
- declare function writeFileAtomic(path: string, content: string): void;
306
- /** Compares two semver versions: negative when `a < b`, positive when `a > b`, `0` when equal */
307
- declare function compareVersions(a: string, b: string): number;
308
- /** Version of the tool (maz-ui by default) that generated a managed content, read from its header */
309
- declare function readManagedVersion(content: string | undefined, tool?: AgentsTool): string | undefined;
310
- /**
311
- * Configures the AI coding agents of a project to use a tool, maz-ui by
312
- * default: rules (version matched with the installed tool) and its MCP server.
313
- * Idempotent and conservative: it only writes files it owns, a delimited
314
- * section of `AGENTS.md` and its own entry of the MCP config files.
315
- */
316
- declare function setupAgents(options: SetupAgentsOptions): SetupAgentsResult;
317
-
318
- export { AGENTS_MD_BEGIN, AGENTS_MD_END, AGENT_TARGETS, DEFAULT_MCP_SERVER, MANAGED_MARKER, MAZ_UI_AGENTS_TOOL, MCP_SERVER_NAME, compareVersions, createLogger, detectAgentTargets, detectPackageManager, execPromise, findInstalledPackage, findProjectPackage, findWorkspaceDirs, installsMcpPackage, isEditedManagedContent, logger, mcpServerCommand, printBanner, readAgentDocs, readManagedVersion, readPackageVersion, readWorkspacePatterns, redactError, redactSecrets, setupAgents, writeFileAtomic };
319
- export type { AgentDocs, AgentTarget, AgentsTool, ExecPromiseOptions, LogLevel, Logger, LoggerOptions, McpServerCommand, PackageManager, SetupAgentsAction, SetupAgentsChange, SetupAgentsOptions, SetupAgentsResult };
172
+ export { createLogger, execPromise, logger, printBanner, redactError, redactSecrets };
173
+ export type { ExecPromiseOptions, LogLevel, Logger, LoggerOptions };