@golemui/gui-mcp 1.5.1 → 1.6.0-rc.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/CHANGELOG.md +11 -0
- package/README.md +17 -12
- package/cli.js +3 -3
- package/{get-concept-MFKfeD4D.js → get-concept-BqdUfdaO.js} +2452 -390
- package/json/generate-from-json-schema.d.ts +28 -10
- package/json/generate-from-openapi.d.ts +28 -10
- package/json/mapping/json-schema-to-gui.d.ts +39 -44
- package/json.js +1 -1
- package/lib.js +2 -2
- package/{list-dx-factories-D3u4qsn1.js → list-dx-factories-BKx43VHj.js} +1 -1
- package/package.json +7 -6
- package/json/mapping/validator.d.ts +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 1.5.1 (2026-09-23)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **gui-mcp:** declare @golemui/dx as a dependency ([5d43a4f0](https://github.com/golemui/golemui/commit/5d43a4f0))
|
|
6
|
+
- **gui-components:** show a restored mid-upload file as failed without emitting a change at mount ([f3597275](https://github.com/golemui/golemui/commit/f3597275))
|
|
7
|
+
|
|
8
|
+
### ❤️ Thank You
|
|
9
|
+
|
|
10
|
+
- Raúl Jiménez @Elecash
|
|
11
|
+
|
|
1
12
|
## 1.5.1-rc.0 (2026-09-23)
|
|
2
13
|
|
|
3
14
|
### 🩹 Fixes
|
package/README.md
CHANGED
|
@@ -98,21 +98,26 @@ like missing `$form.` prefixes, single `=` in equality checks, and unbalanced br
|
|
|
98
98
|
|
|
99
99
|
### `json_generate_from_schema`
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
form definition
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
Converts a JSON Schema (the form-data shape, e.g. a Zod-derived schema) into a GolemUI
|
|
102
|
+
form definition, with `fromJsonSchema` from `@golemui/schemas/json-schema` and the gui
|
|
103
|
+
preset from `@golemui/gui-schemas/json-schema`. It handles formats, enums, local `$ref`,
|
|
104
|
+
`allOf`, nested objects, arrays, discriminated `oneOf`/`anyOf`, and `if/then/else` and
|
|
105
|
+
`dependent*` as conditions and form states. The result is validated before it is returned.
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
`diagnostics` lists what the form cannot express exactly, each with a `severity`, a `code`,
|
|
108
|
+
the data `path` and the JSON `pointer` into the input. `unmapped` repeats its errors and
|
|
109
|
+
warnings as `{ path, reason }`. `rules` and `overrides` choose other widgets: see the
|
|
110
|
+
`@golemui/schemas` README.
|
|
111
|
+
|
|
112
|
+
**Input:** `{ jsonSchema, submitAction?, submitLabel?, layout?, rules?, overrides? }`
|
|
108
113
|
|
|
109
114
|
### `json_generate_from_openapi`
|
|
110
115
|
|
|
111
|
-
Resolves an OpenAPI 3.x operation (e.g. `"POST /users"` or an `operationId`)
|
|
112
|
-
its request body
|
|
113
|
-
parameters when no
|
|
116
|
+
Resolves an OpenAPI 3.x operation (e.g. `"POST /users"` or an `operationId`) and converts
|
|
117
|
+
its JSON request body, with its `$ref`s into the document, like `json_generate_from_schema`.
|
|
118
|
+
Falls back to the operation parameters when there is no object request body.
|
|
114
119
|
|
|
115
|
-
**Input:** `{ document | documentUrl, operation, submitAction?, submitLabel? }`
|
|
120
|
+
**Input:** `{ document | documentUrl, operation, submitAction?, submitLabel?, rules?, overrides? }`
|
|
116
121
|
|
|
117
122
|
### `json_get_widget_spec`
|
|
118
123
|
|
|
@@ -184,10 +189,10 @@ const result = validateFormDefinition({ formDefinition: myForm });
|
|
|
184
189
|
if (!result.valid) console.error(result.errors);
|
|
185
190
|
|
|
186
191
|
// Generate a form from a JSON Schema
|
|
187
|
-
const {
|
|
192
|
+
const { formDefinition, diagnostics } = generateFromJsonSchema({ jsonSchema: mySchema });
|
|
188
193
|
|
|
189
194
|
// Generate a form from an OpenAPI spec
|
|
190
|
-
const {
|
|
195
|
+
const { formDefinition: userForm } = await generateFromOpenapi({
|
|
191
196
|
documentUrl: 'https://example.com/openapi.json',
|
|
192
197
|
operation: 'POST /users',
|
|
193
198
|
});
|
package/cli.js
CHANGED
|
@@ -5,8 +5,8 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
7
|
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
-
import { d as checkDxCode, r as resolveDxFramework, f as listDxFactoriesCatalog, b as DX_LIST_FACTORIES_TOOL, g as getDxSpec, a as DX_GET_SPEC_TOOL, D as DX_CHECK_CODE_TOOL } from "./list-dx-factories-
|
|
9
|
-
import { v as validateFormDefinition, c as JSON_VALIDATE_FORM_DEFINITION_TOOL, g as generateFromJsonSchema, a as JSON_GENERATE_FROM_SCHEMA_TOOL, d as generateFromOpenapi, J as JSON_GENERATE_FROM_OPENAPI_TOOL, f as getWidgetSpec, b as JSON_GET_WIDGET_SPEC_TOOL, e as getConcept, G as GET_CONCEPT_TOOL } from "./get-concept-
|
|
8
|
+
import { d as checkDxCode, r as resolveDxFramework, f as listDxFactoriesCatalog, b as DX_LIST_FACTORIES_TOOL, g as getDxSpec, a as DX_GET_SPEC_TOOL, D as DX_CHECK_CODE_TOOL } from "./list-dx-factories-BKx43VHj.js";
|
|
9
|
+
import { v as validateFormDefinition, c as JSON_VALIDATE_FORM_DEFINITION_TOOL, g as generateFromJsonSchema, a as JSON_GENERATE_FROM_SCHEMA_TOOL, d as generateFromOpenapi, J as JSON_GENERATE_FROM_OPENAPI_TOOL, f as getWidgetSpec, b as JSON_GET_WIDGET_SPEC_TOOL, e as getConcept, G as GET_CONCEPT_TOOL } from "./get-concept-BqdUfdaO.js";
|
|
10
10
|
const USAGE = `Usage: golemui-mcp [command]
|
|
11
11
|
|
|
12
12
|
Validate GolemUI forms from the command line (no MCP client needed).
|
|
@@ -110,7 +110,7 @@ const dxTools = [
|
|
|
110
110
|
defineTool(DX_GET_SPEC_TOOL, getDxSpec),
|
|
111
111
|
defineTool(DX_CHECK_CODE_TOOL, checkDxCode)
|
|
112
112
|
];
|
|
113
|
-
const JSON_INSTRUCTIONS = '1. Starting from an existing schema? Use a generator — both return a pre-validated definition, so check the returned `unmapped` list and surface anything left over to the user. For a raw JSON Schema (e.g. an API request body), call `json_generate_from_schema`. For an OpenAPI 3.x spec, call `json_generate_from_openapi`: pass `operation` as "METHOD /path" (e.g. "POST /users") or an exact operationId, plus the spec as a parsed `document` or a `documentUrl` to fetch — it resolves the operation\'s request body, dereferences `$ref`s, and falls back to the operation\'s parameters when there is no request body.\n2. Building or editing by hand? Look up a single widget with `json_get_widget_spec` (its `kind`, `props`, and `validator` shape), and cross-cutting behavior that spans widgets — conditional rendering, per-state prop overrides, validation rules and error messages — with `get_concept`. Before writing a mandatory checkbox or gating a button on `$formIsInvalid`, call `get_concept({ concept: "validation" })` — both have non-obvious traps.\n3. ALWAYS finish by calling `json_validate_form_definition`. It checks the definition against the bundled JSON Schemas and returns `{ valid, errors, warnings, expressionWarnings }`. Treat `errors` as blocking: fix them and re-validate until `valid` is true. `warnings` (likely-custom widgets) and `expressionWarnings` (linted reactive expressions) are advisory — surface them, but they do not flip `valid`.\n\n';
|
|
113
|
+
const JSON_INSTRUCTIONS = '1. Starting from an existing schema? Use a generator — both return a pre-validated definition, so check the returned `unmapped` list and surface anything left over to the user. For a raw JSON Schema (e.g. an API request body), call `json_generate_from_schema`. For an OpenAPI 3.x spec, call `json_generate_from_openapi`: pass `operation` as "METHOD /path" (e.g. "POST /users") or an exact operationId, plus the spec as a parsed `document` or a `documentUrl` to fetch — it resolves the operation\'s request body, dereferences `$ref`s, and falls back to the operation\'s parameters when there is no request body. Both also return `diagnostics` (severity, code, path, pointer), and both take optional `overrides` (widget fields by data path, e.g. `{ "address.street": { "widget": "textarea" } }`) and `rules` to choose other widgets.\n2. Building or editing by hand? Look up a single widget with `json_get_widget_spec` (its `kind`, `props`, and `validator` shape), and cross-cutting behavior that spans widgets — conditional rendering, per-state prop overrides, validation rules and error messages — with `get_concept`. Before writing a mandatory checkbox or gating a button on `$formIsInvalid`, call `get_concept({ concept: "validation" })` — both have non-obvious traps.\n3. ALWAYS finish by calling `json_validate_form_definition`. It checks the definition against the bundled JSON Schemas and returns `{ valid, errors, warnings, expressionWarnings }`. Treat `errors` as blocking: fix them and re-validate until `valid` is true. `warnings` (likely-custom widgets) and `expressionWarnings` (linted reactive expressions) are advisory — surface them, but they do not flip `valid`.\n\n';
|
|
114
114
|
const jsonTools = [
|
|
115
115
|
defineTool(JSON_VALIDATE_FORM_DEFINITION_TOOL, validateFormDefinition),
|
|
116
116
|
defineTool(JSON_GENERATE_FROM_SCHEMA_TOOL, generateFromJsonSchema),
|