@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.
@@ -1,20 +1,15 @@
1
- import { JsonSchemaLike } from './mapping/json-schema-to-gui';
1
+ import { DeclarativeRule, WidgetPatch } from '@golemui/schemas/json-schema';
2
+ import { JsonSchemaLike, MapResult } from './mapping/json-schema-to-gui';
2
3
  import { validateFormDefinition } from './validate-form-definition';
3
4
  export type GenerateFromJsonSchemaInput = {
4
5
  jsonSchema: JsonSchemaLike;
5
6
  submitAction?: boolean;
6
7
  submitLabel?: string;
7
8
  layout?: 'vertical' | 'horizontal' | 'grid';
9
+ rules?: DeclarativeRule[];
10
+ overrides?: Record<string, WidgetPatch>;
8
11
  };
9
- export type GenerateFromJsonSchemaResult = {
10
- formDefinition: {
11
- $schema: string;
12
- form: unknown[];
13
- };
14
- unmapped: {
15
- path: string;
16
- reason: string;
17
- }[];
12
+ export type GenerateFromJsonSchemaResult = MapResult & {
18
13
  validation: ReturnType<typeof validateFormDefinition>;
19
14
  };
20
15
  export declare function generateFromJsonSchema(input: GenerateFromJsonSchemaInput): GenerateFromJsonSchemaResult;
@@ -24,6 +19,29 @@ export declare const JSON_GENERATE_FROM_SCHEMA_TOOL: {
24
19
  readonly inputSchema: {
25
20
  readonly type: "object";
26
21
  readonly properties: {
22
+ readonly rules: {
23
+ type: "array";
24
+ description: string;
25
+ items: {
26
+ type: "object";
27
+ additionalProperties: boolean;
28
+ properties: {
29
+ match: {
30
+ type: "object";
31
+ additionalProperties: boolean;
32
+ };
33
+ };
34
+ required: string[];
35
+ };
36
+ };
37
+ readonly overrides: {
38
+ type: "object";
39
+ description: string;
40
+ additionalProperties: {
41
+ type: "object";
42
+ additionalProperties: boolean;
43
+ };
44
+ };
27
45
  readonly jsonSchema: {
28
46
  readonly type: "object";
29
47
  readonly additionalProperties: true;
@@ -1,4 +1,5 @@
1
- import { JsonSchemaLike } from './mapping/json-schema-to-gui';
1
+ import { DeclarativeRule, WidgetPatch } from '@golemui/schemas/json-schema';
2
+ import { JsonSchemaLike, MapResult } from './mapping/json-schema-to-gui';
2
3
  import { validateFormDefinition } from './validate-form-definition';
3
4
  type OpenAPIDoc = {
4
5
  openapi?: string;
@@ -29,21 +30,15 @@ export type GenerateFromOpenapiInput = {
29
30
  operation: string;
30
31
  submitAction?: boolean;
31
32
  submitLabel?: string;
33
+ rules?: DeclarativeRule[];
34
+ overrides?: Record<string, WidgetPatch>;
32
35
  };
33
- export type GenerateFromOpenapiResult = {
36
+ export type GenerateFromOpenapiResult = MapResult & {
34
37
  resolvedOperation: {
35
38
  method: string;
36
39
  path: string;
37
40
  operationId?: string;
38
41
  };
39
- formDefinition: {
40
- $schema: string;
41
- form: unknown[];
42
- };
43
- unmapped: {
44
- path: string;
45
- reason: string;
46
- }[];
47
42
  validation: ReturnType<typeof validateFormDefinition>;
48
43
  };
49
44
  export declare function generateFromOpenapi(input: GenerateFromOpenapiInput): Promise<GenerateFromOpenapiResult>;
@@ -53,6 +48,29 @@ export declare const JSON_GENERATE_FROM_OPENAPI_TOOL: {
53
48
  readonly inputSchema: {
54
49
  readonly type: "object";
55
50
  readonly properties: {
51
+ readonly rules: {
52
+ type: "array";
53
+ description: string;
54
+ items: {
55
+ type: "object";
56
+ additionalProperties: boolean;
57
+ properties: {
58
+ match: {
59
+ type: "object";
60
+ additionalProperties: boolean;
61
+ };
62
+ };
63
+ required: string[];
64
+ };
65
+ };
66
+ readonly overrides: {
67
+ type: "object";
68
+ description: string;
69
+ additionalProperties: {
70
+ type: "object";
71
+ additionalProperties: boolean;
72
+ };
73
+ };
56
74
  readonly documentUrl: {
57
75
  readonly type: "string";
58
76
  readonly description: "URL of a JSON OpenAPI document. Either this or `document` is required.";
@@ -1,56 +1,51 @@
1
- /**
2
- * Deterministic mapping from a JSON Schema (the form-data shape) to a GolemUI form definition.
3
- *
4
- * Handles the practical 80% of API/Zod-derived schemas:
5
- * - primitive properties (string/number/integer/boolean) with formats and constraints
6
- * - enum strings as `select` (≤ 6 options) or `dropdown` (more)
7
- * - nested objects rendered inline as `flex` layouts
8
- * - arrays of objects as `repeater` with a `flex` template
9
- *
10
- * Constructs unmapped: anything we can't cleanly express. They're returned as `unmapped[]`
11
- * so the caller (and any LLM) can surface a partial form rather than a hard failure.
12
- */
13
- export type JsonSchemaLike = {
14
- type?: string | string[];
15
- format?: string;
16
- title?: string;
17
- description?: string;
18
- enum?: unknown[];
19
- const?: unknown;
20
- minLength?: number;
21
- maxLength?: number;
22
- pattern?: string;
23
- minimum?: number;
24
- maximum?: number;
25
- exclusiveMinimum?: number;
26
- exclusiveMaximum?: number;
27
- multipleOf?: number;
28
- minItems?: number;
29
- maxItems?: number;
30
- uniqueItems?: boolean;
31
- default?: unknown;
32
- required?: string[];
33
- properties?: Record<string, JsonSchemaLike>;
34
- items?: JsonSchemaLike;
35
- oneOf?: JsonSchemaLike[];
36
- anyOf?: JsonSchemaLike[];
37
- $ref?: string;
38
- [k: string]: unknown;
39
- };
1
+ import { DeclarativeRule, Diagnostic, FormDefinitionJson, JsonSchema, WidgetPatch } from '@golemui/schemas/json-schema';
2
+ /** A JSON Schema object, under the name the tool types have always used. */
3
+ export type JsonSchemaLike = JsonSchema;
40
4
  export type MapOptions = {
41
5
  submitAction?: boolean;
42
6
  submitLabel?: string;
43
7
  layout?: 'vertical' | 'horizontal' | 'grid';
8
+ /** Declarative rules, checked before the gui preset rules. */
9
+ rules?: DeclarativeRule[];
10
+ /** Widget fields by form data path or by `$defs/<Name>`. */
11
+ overrides?: Record<string, WidgetPatch>;
12
+ /** The document `$ref` values resolve against, e.g. an OpenAPI document. */
13
+ refRoot?: JsonSchema;
44
14
  };
45
15
  export type Unmapped = {
46
16
  path: string;
47
17
  reason: string;
48
18
  };
49
19
  export type MapResult = {
50
- formDefinition: {
51
- $schema: string;
52
- form: unknown[];
53
- };
20
+ formDefinition: FormDefinitionJson;
21
+ /** The warnings and errors of `diagnostics`: what is not rendered, or rendered approximately. */
54
22
  unmapped: Unmapped[];
23
+ diagnostics: Diagnostic[];
24
+ };
25
+ /** The `rules` and `overrides` inputs of the generate tools, in MCP input schema form. */
26
+ export declare const CUSTOMIZATION_INPUT_PROPERTIES: {
27
+ rules: {
28
+ type: "array";
29
+ description: string;
30
+ items: {
31
+ type: "object";
32
+ additionalProperties: boolean;
33
+ properties: {
34
+ match: {
35
+ type: "object";
36
+ additionalProperties: boolean;
37
+ };
38
+ };
39
+ required: string[];
40
+ };
41
+ };
42
+ overrides: {
43
+ type: "object";
44
+ description: string;
45
+ additionalProperties: {
46
+ type: "object";
47
+ additionalProperties: boolean;
48
+ };
49
+ };
55
50
  };
56
- export declare function jsonSchemaToGui(schema: JsonSchemaLike, opts?: MapOptions): MapResult;
51
+ export declare function jsonSchemaToGui(schema: JsonSchemaLike, options?: MapOptions): MapResult;
package/json.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G, J, a, b, c, g, d, e, f, v } from "./get-concept-MFKfeD4D.js";
1
+ import { G, J, a, b, c, g, d, e, f, v } from "./get-concept-BqdUfdaO.js";
2
2
  export {
3
3
  G as GET_CONCEPT_TOOL,
4
4
  J as JSON_GENERATE_FROM_OPENAPI_TOOL,
package/lib.js CHANGED
@@ -1,5 +1,5 @@
1
- import { G, J, a, b, c, g, d, e, f, v } from "./get-concept-MFKfeD4D.js";
2
- import { D, a as a2, b as b2, c as c2, d as d2, e as e2, g as g2, l, f as f2, t } from "./list-dx-factories-D3u4qsn1.js";
1
+ import { G, J, a, b, c, g, d, e, f, v } from "./get-concept-BqdUfdaO.js";
2
+ import { D, a as a2, b as b2, c as c2, d as d2, e as e2, g as g2, l, f as f2, t } from "./list-dx-factories-BKx43VHj.js";
3
3
  export {
4
4
  D as DX_CHECK_CODE_TOOL,
5
5
  a2 as DX_GET_SPEC_TOOL,
@@ -1,4 +1,4 @@
1
- import { h as checkReactiveExpression, i as checkBooleanValidatorRules } from "./get-concept-MFKfeD4D.js";
1
+ import { h as checkReactiveExpression, i as checkBooleanValidatorRules } from "./get-concept-BqdUfdaO.js";
2
2
  import { existsSync } from "node:fs";
3
3
  import { createRequire } from "node:module";
4
4
  import { resolve, join, dirname } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/gui-mcp",
3
- "version": "1.5.1",
3
+ "version": "1.6.0-rc.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -43,11 +43,12 @@
43
43
  "ajv": "^8.17.1",
44
44
  "ajv-formats": "^3.0.1",
45
45
  "typescript": "^5.9.2",
46
- "@golemui/gui-schemas": "1.5.1",
47
- "@golemui/gui-shared": "1.5.1",
48
- "@golemui/gui-validators": "1.5.1",
49
- "@golemui/dx": "1.5.1",
50
- "@golemui/core": "1.5.1",
46
+ "@golemui/gui-schemas": "1.6.0-rc.0",
47
+ "@golemui/schemas": "1.6.0-rc.0",
48
+ "@golemui/gui-shared": "1.6.0-rc.0",
49
+ "@golemui/gui-validators": "1.6.0-rc.0",
50
+ "@golemui/dx": "1.6.0-rc.0",
51
+ "@golemui/core": "1.6.0-rc.0",
51
52
  "@modelcontextprotocol/sdk": "^1.0.0",
52
53
  "zod": "^4.0.0",
53
54
  "@standard-schema/spec": "^1.0.0"
@@ -1,29 +0,0 @@
1
- import { JsonSchemaLike } from './json-schema-to-gui';
2
- export type StringValidator = {
3
- type: 'string';
4
- required?: boolean;
5
- minLength?: number;
6
- maxLength?: number;
7
- pattern?: string;
8
- format?: string;
9
- const?: unknown;
10
- enum?: unknown[];
11
- };
12
- export type NumberValidator = {
13
- type: 'number' | 'integer';
14
- required?: boolean;
15
- minimum?: number;
16
- maximum?: number;
17
- exclusiveMinimum?: number;
18
- exclusiveMaximum?: number;
19
- multipleOf?: number;
20
- };
21
- export type BooleanValidator = {
22
- type: 'boolean';
23
- required?: boolean;
24
- const?: unknown;
25
- };
26
- export type Validator = StringValidator | NumberValidator | BooleanValidator;
27
- export declare function buildStringValidator(s: JsonSchemaLike, required: boolean): StringValidator | undefined;
28
- export declare function buildNumberValidator(s: JsonSchemaLike, required: boolean, t: 'number' | 'integer'): NumberValidator | undefined;
29
- export declare function buildBooleanValidator(s: JsonSchemaLike, required: boolean): BooleanValidator | undefined;