@regle/mcp-server 1.18.0-beta.3 → 1.18.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/regle-mcp-server.js +48 -4
- package/package.json +4 -4
package/dist/regle-mcp-server.js
CHANGED
|
@@ -118,7 +118,7 @@ var docs_data_default = {
|
|
|
118
118
|
"title": "Displaying errors",
|
|
119
119
|
"category": "core-concepts",
|
|
120
120
|
"path": "core-concepts/displaying-errors.md",
|
|
121
|
-
"content": "# Displaying errors\n\nRegle is a headless library, allowing you to display error messages in any way you choose. You can also use its internal state to apply classes or trigger behaviors dynamically.\n\n## Showing errors messages\n\nYou can display your errors by iterating though `r$.xxx.$errors`, `xxx` being the field you need to check.\n\nYou can also access `r$.$errors.xxx` or `r$.$silentErrors.xxx`.\n\nResult:\n\n## Display custom error messages\n\nTo display custom error messages, you can use the [withMessage](/core-concepts/rules/rule-wrappers#withmessage) helper. \nYou have access to additional data like parameters or rule status to write your message.\n\n:::tip\nIf you fall into this case:\n- You have a lot of forms in your app\n- You want to share translations easily between your forms\n\nConsider using [defineRegleConfig](/advanced-usage/global-config#replace-built-in-rules-messages) instead.\n:::\n\n``` vue [App.vue]\n\n```\n\n## i18n and translations\n\nRegle is library agnostic so you can use any i18n library freely, and there is nothing specific to configure, it will just work out of the box.\n\n```vue\n\n```\n\n## Applying an error and valid class\n\nResult:\n\n## Display flat errors\n\nIf you want to display the complete list of errors of a form, or the total count of errors, you can use the `flatErrors` utility.\n\nIt will return an array of error strings.\n\n```ts\nimport { flatErrors, useRegle } from '@regle/core';\nimport { email, minLength, required } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { name: '', level0: { email: 'bar' } },\n {\n name: { required, minLength: minLength(5) },\n level0: {\n email: { email },\n },\n }\n);\n\nr$.$validate();\n\nconst flattenErrors = flatErrors(r$.$errors);\n// [\n// \"This field is required\", \n// \"Value must be an valid email address\"\n// ]\n```\n\n### `includePath` option\n\nThis helper also include an option to have the path of the property and returns the issues in Standard Schema Issue format.\n\n```ts\nimport { flatErrors, useRegle } from '@regle/core';\nimport { email, minLength, required } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { name: '', level0: { email: 'bar' } },\n {\n name: { required, minLength: minLength(5) },\n level0: {\n email: { email },\n },\n }\n);\n\nr$.$validate();\n\nconst flattenErrors = flatErrors(r$.$errors, {includePath: true});\n// [\n// { message: \"This field is required\", path: [\"name\"] }, \n// { message: \"Value must be an valid email address\", path: [\"level0\", \"email\"]}\n// ]\n```"
|
|
121
|
+
"content": "# Displaying errors\n\nRegle is a headless library, allowing you to display error messages in any way you choose. You can also use its internal state to apply classes or trigger behaviors dynamically.\n\n## Showing errors messages\n\nYou can display your errors by iterating though `r$.xxx.$errors`, `xxx` being the field you need to check.\n\nYou can also access `r$.$errors.xxx` or `r$.$silentErrors.xxx`.\n\nResult:\n\n## Display custom error messages\n\nTo display custom error messages, you can use the [withMessage](/core-concepts/rules/rule-wrappers#withmessage) helper. \nYou have access to additional data like parameters or rule status to write your message.\n\n:::tip\nIf you fall into this case:\n- You have a lot of forms in your app\n- You want to share translations easily between your forms\n\nConsider using [defineRegleConfig](/advanced-usage/global-config#replace-built-in-rules-messages) instead.\n:::\n\n``` vue [App.vue]\n\n```\n\n## i18n and translations\n\nRegle is library agnostic so you can use any i18n library freely, and there is nothing specific to configure, it will just work out of the box.\n\n```vue\n\n```\n\n## Applying an error and valid class\n\nResult:\n\n## Get errors by path\n\nIf you need to access errors for a specific field using a dot-notation path, you can use the `getErrors` utility. This is useful when you need to programmatically access errors or when building reusable input components.\n\n```ts\nimport { getErrors, useRegle } from '@regle/core';\nimport { required, email } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { user: { email: '' }, contacts: [{ name: '' }] },\n {\n user: { email: { required, email } },\n contacts: { $each: { name: { required } } }\n }\n);\n\nawait r$.$validate();\n\n// Access nested errors with dot notation\nconst emailErrors = getErrors(r$, 'user.email');\n// ['This field is required']\n\n// Access collection item errors\nconst contactErrors = getErrors(r$, 'contacts.$each.0.name');\n// ['This field is required']\n```\n\n:::tip\nThe path parameter is **type-safe** - TypeScript will autocomplete available paths and show an error if you try to access a path that doesn't exist or isn't a field with errors.\n:::\n\n## Get issues by path\n\nSimilar to `getErrors`, the `getIssues` utility returns detailed validation issues including metadata like the rule name and custom properties.\n\n```ts\nimport { getIssues, useRegle } from '@regle/core';\nimport { required, minLength } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { user: { name: '' } },\n { user: { name: { required, minLength: minLength(3) } } }\n);\n\nawait r$.$validate();\n\nconst nameIssues = getIssues(r$, 'user.name');\n// [{\n// $message: 'This field is required',\n// $property: 'name',\n// $rule: 'required',\n// $type: 'required'\n// }]\n```\n\n## Display flat errors\n\nIf you want to display the complete list of errors of a form, or the total count of errors, you can use the `flatErrors` utility.\n\nIt will return an array of error strings.\n\n```ts\nimport { flatErrors, useRegle } from '@regle/core';\nimport { email, minLength, required } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { name: '', level0: { email: 'bar' } },\n {\n name: { required, minLength: minLength(5) },\n level0: {\n email: { email },\n },\n }\n);\n\nr$.$validate();\n\nconst flattenErrors = flatErrors(r$.$errors);\n// [\n// \"This field is required\", \n// \"Value must be an valid email address\"\n// ]\n```\n\n### `includePath` option\n\nThis helper also include an option to have the path of the property and returns the issues in Standard Schema Issue format.\n\n```ts\nimport { flatErrors, useRegle } from '@regle/core';\nimport { email, minLength, required } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { name: '', level0: { email: 'bar' } },\n {\n name: { required, minLength: minLength(5) },\n level0: {\n email: { email },\n },\n }\n);\n\nr$.$validate();\n\nconst flattenErrors = flatErrors(r$.$errors, {includePath: true});\n// [\n// { message: \"This field is required\", path: [\"name\"] }, \n// { message: \"Value must be an valid email address\", path: [\"level0\", \"email\"]}\n// ]\n```"
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"id": "core-concepts-index",
|
|
@@ -445,6 +445,50 @@ var docs_data_default = {
|
|
|
445
445
|
"example": "import { flatErrors, useRegle } from '@regle/core';\nimport { required, email, minLength } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { name: '', email: 'invalid' },\n { name: { required, minLength: minLength(3) }, email: { email } }\n);\n\nawait r$.$validate();\n\n// Get flat array of error messages\nconst errors = flatErrors(r$.$errors);\n// ['This field is required', 'Value must be a valid email address']\n\n// Get errors with paths (Standard Schema format)\nconst issues = flatErrors(r$.$errors, { includePath: true });\n// [{ message: 'This field is required', path: ['name'] }, ...]",
|
|
446
446
|
"tags": { "see": "://reglejs.dev/core-concepts/displaying-errors#display-flat-errors Documentation" }
|
|
447
447
|
},
|
|
448
|
+
{
|
|
449
|
+
"name": "getErrors",
|
|
450
|
+
"kind": "function",
|
|
451
|
+
"description": "Retrieves error messages for a specific field using a dot-notation path.\nProvides type-safe access to nested error arrays in a Regle instance.",
|
|
452
|
+
"parameters": [{
|
|
453
|
+
"name": "r$",
|
|
454
|
+
"type": "MaybeRef<TRegle>",
|
|
455
|
+
"description": "- The Regle instance (e.g., from `useRegle()`)",
|
|
456
|
+
"optional": false
|
|
457
|
+
}, {
|
|
458
|
+
"name": "path",
|
|
459
|
+
"type": "TPath",
|
|
460
|
+
"description": "- Dot-notation path to the field (e.g., `'user.email'` or `'items.0.name'`)",
|
|
461
|
+
"optional": false
|
|
462
|
+
}],
|
|
463
|
+
"returnType": "IsStringLiteral<TPath> extends true ? Get<TRegle['$errors'], TPath & string> : string[] | undefined",
|
|
464
|
+
"example": "import { getErrors, useRegle } from '@regle/core';\nimport { required, email } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { user: { email: '' } },\n { user: { email: { required, email } } }\n);\n\nawait r$.$validate();\n\n// Type-safe access to nested errors\nconst emailErrors = getErrors(r$, 'user.email');\n// ['This field is required']\n\n// Works with collections too\nconst itemErrors = getErrors(r$, 'items.0.name');",
|
|
465
|
+
"tags": {
|
|
466
|
+
"typeParam": "TPath - The dot-notation path type, validated at compile-time",
|
|
467
|
+
"see": "://reglejs.dev/core-concepts/displaying-errors#get-errors-by-path Documentation"
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"name": "getIssues",
|
|
472
|
+
"kind": "function",
|
|
473
|
+
"description": "Retrieves detailed validation issues for a specific field using a dot-notation path.\nIssues contain more information than errors, including the rule name, property, and metadata.",
|
|
474
|
+
"parameters": [{
|
|
475
|
+
"name": "r$",
|
|
476
|
+
"type": "MaybeRef<TRegle>",
|
|
477
|
+
"description": "- The Regle instance (e.g., from `useRegle()`)",
|
|
478
|
+
"optional": false
|
|
479
|
+
}, {
|
|
480
|
+
"name": "path",
|
|
481
|
+
"type": "TPath | (string & {})",
|
|
482
|
+
"description": "- Dot-notation path to the field (e.g., `'user.email'` or `'items.0.name'`)",
|
|
483
|
+
"optional": false
|
|
484
|
+
}],
|
|
485
|
+
"returnType": "IsStringLiteral<TPath> extends true ? Get<TRegle['$issues'], TPath & string> : RegleFieldIssue[] | undefined",
|
|
486
|
+
"example": "import { getIssues, useRegle } from '@regle/core';\nimport { required, email } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { user: { email: '' } },\n { user: { email: { required, email } } }\n);\n\nawait r$.$validate();\n\n// Type-safe access to nested issues with full metadata\nconst emailIssues = getIssues(r$, 'user.email');\n// [{\n// $message: 'This field is required',\n// $property: 'email',\n// $rule: 'required'\n// }]\n\n// Works with collections too\nconst itemIssues = getIssues(r$, 'items.0.name');",
|
|
487
|
+
"tags": {
|
|
488
|
+
"typeParam": "TPath - The dot-notation path type, validated at compile-time",
|
|
489
|
+
"see": "://reglejs.dev/core-concepts/displaying-errors#get-issues-by-path Documentation"
|
|
490
|
+
}
|
|
491
|
+
},
|
|
448
492
|
{
|
|
449
493
|
"name": "inferRules",
|
|
450
494
|
"kind": "const",
|
|
@@ -1890,7 +1934,7 @@ function searchApi(query) {
|
|
|
1890
1934
|
return results;
|
|
1891
1935
|
}
|
|
1892
1936
|
|
|
1893
|
-
var version = "1.18.0
|
|
1937
|
+
var version = "1.18.0";
|
|
1894
1938
|
|
|
1895
1939
|
let posthogClient = null;
|
|
1896
1940
|
posthogClient = new PostHog("phc_kqgJoylCpKkGkkRGxb4MyN2mViehoQcUFEGwVkk4l8E", {
|
|
@@ -1928,10 +1972,10 @@ async function shutdown() {
|
|
|
1928
1972
|
if (posthogClient) await posthogClient.shutdown();
|
|
1929
1973
|
}
|
|
1930
1974
|
|
|
1931
|
-
function jsonResponse(data
|
|
1975
|
+
function jsonResponse(data) {
|
|
1932
1976
|
return { content: [{
|
|
1933
1977
|
type: "text",
|
|
1934
|
-
text: JSON.stringify(data
|
|
1978
|
+
text: JSON.stringify(data, null, 2)
|
|
1935
1979
|
}] };
|
|
1936
1980
|
}
|
|
1937
1981
|
function errorResponse(error, extra) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regle/mcp-server",
|
|
3
|
-
"version": "1.18.0
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "MCP Server for Regle",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@modelcontextprotocol/sdk": "1.25.3",
|
|
49
49
|
"posthog-node": "5.24.1",
|
|
50
|
-
"zod": "4.3.
|
|
50
|
+
"zod": "4.3.6"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/node": "
|
|
53
|
+
"@types/node": "24.1.0",
|
|
54
54
|
"dotenv": "17.2.3",
|
|
55
|
-
"tsdown": "0.
|
|
55
|
+
"tsdown": "0.20.1",
|
|
56
56
|
"tsx": "4.21.0",
|
|
57
57
|
"typescript": "5.9.3"
|
|
58
58
|
},
|