@restforgejs/mcp-server 1.2.0 → 1.2.2

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.
Files changed (56) hide show
  1. package/README.md +51 -8
  2. package/dist/server.js +71 -1
  3. package/dist/server.js.map +1 -1
  4. package/dist/tools/codegen/dbschema-apply.d.ts +2 -0
  5. package/dist/tools/codegen/dbschema-apply.js +324 -0
  6. package/dist/tools/codegen/dbschema-apply.js.map +1 -0
  7. package/dist/tools/codegen/dbschema-diff.d.ts +2 -0
  8. package/dist/tools/codegen/dbschema-diff.js +352 -0
  9. package/dist/tools/codegen/dbschema-diff.js.map +1 -0
  10. package/dist/tools/codegen/dbschema-generate-ddl.js +6 -3
  11. package/dist/tools/codegen/dbschema-generate-ddl.js.map +1 -1
  12. package/dist/tools/codegen/dbschema-init.js +9 -2
  13. package/dist/tools/codegen/dbschema-init.js.map +1 -1
  14. package/dist/tools/codegen/dbschema-introspect.js +25 -19
  15. package/dist/tools/codegen/dbschema-introspect.js.map +1 -1
  16. package/dist/tools/codegen/dbschema-migrate.js +55 -26
  17. package/dist/tools/codegen/dbschema-migrate.js.map +1 -1
  18. package/dist/tools/codegen/dbschema-models.js +11 -12
  19. package/dist/tools/codegen/dbschema-models.js.map +1 -1
  20. package/dist/tools/codegen/dbschema-template.d.ts +2 -0
  21. package/dist/tools/codegen/dbschema-template.js +384 -0
  22. package/dist/tools/codegen/dbschema-template.js.map +1 -0
  23. package/dist/tools/codegen/dbschema-validate.js +13 -13
  24. package/dist/tools/codegen/dbschema-validate.js.map +1 -1
  25. package/dist/tools/codegen/generate-payload.js +1 -1
  26. package/dist/tools/codegen/get-dbschema-catalog.js +4 -2
  27. package/dist/tools/codegen/get-dbschema-catalog.js.map +1 -1
  28. package/dist/tools/codegen/index.js +6 -0
  29. package/dist/tools/codegen/index.js.map +1 -1
  30. package/dist/tools/codegen/list-tables.js +4 -1
  31. package/dist/tools/codegen/list-tables.js.map +1 -1
  32. package/dist/tools/designer/generate.d.ts +2 -0
  33. package/dist/tools/designer/generate.js +212 -0
  34. package/dist/tools/designer/generate.js.map +1 -0
  35. package/dist/tools/designer/index.d.ts +2 -0
  36. package/dist/tools/designer/index.js +17 -0
  37. package/dist/tools/designer/index.js.map +1 -0
  38. package/dist/tools/designer/init-project.d.ts +2 -0
  39. package/dist/tools/designer/init-project.js +235 -0
  40. package/dist/tools/designer/init-project.js.map +1 -0
  41. package/dist/tools/designer/inspect-plugin.d.ts +2 -0
  42. package/dist/tools/designer/inspect-plugin.js +148 -0
  43. package/dist/tools/designer/inspect-plugin.js.map +1 -0
  44. package/dist/tools/designer/list-plugins.d.ts +2 -0
  45. package/dist/tools/designer/list-plugins.js +141 -0
  46. package/dist/tools/designer/list-plugins.js.map +1 -0
  47. package/dist/tools/designer/preview-files.d.ts +2 -0
  48. package/dist/tools/designer/preview-files.js +150 -0
  49. package/dist/tools/designer/preview-files.js.map +1 -0
  50. package/dist/tools/designer/scaffold-plugin.d.ts +2 -0
  51. package/dist/tools/designer/scaffold-plugin.js +162 -0
  52. package/dist/tools/designer/scaffold-plugin.js.map +1 -0
  53. package/dist/tools/designer/validate-payload.d.ts +2 -0
  54. package/dist/tools/designer/validate-payload.js +158 -0
  55. package/dist/tools/designer/validate-payload.js.map +1 -0
  56. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"list-tables.js","sourceRoot":"","sources":["../../../src/tools/codegen/list-tables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,sB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AO,CAAC,OAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YAChF,CAAC,CAAC,SAAS,CAAC;QAEd,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAEnD,sFAAsF;QACtF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;gBAEF,UAAU;UAChB,MAAM;YACJ,YAAY;iBACP,MAAM,IAAI,wBAAwB;eACpC,WAAW;qBACL,eAAe;;;EAGlC,UAAU;;;;;;;;;6BASiB;iBAClB;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerDesignerGenerate(server: McpServer): void;
@@ -0,0 +1,212 @@
1
+ import { z } from 'zod';
2
+ import { resolve } from 'node:path';
3
+ import { execProcess } from '../../lib/exec.js';
4
+ export function registerDesignerGenerate(server) {
5
+ server.registerTool('designer_generate', {
6
+ title: 'Generate Designer Frontend',
7
+ description: `Generate frontend code from a UI Definition File (UDF) payload, by running restforge-designer generate. This WRITES the generated frontend files to disk.
8
+
9
+ USE WHEN:
10
+ - The user asks to generate / build the frontend application from a UDF payload
11
+ - The user asks things like "generate aplikasi frontend dari UDF", "build frontend dari payload", "generate satu page/form" (scope=form), "generate the frontend code", "build the frontend from this UI definition", "generate frontend designer"
12
+ - The user has a valid UDF payload and wants the real frontend files produced (not just a preview)
13
+ - The user wants to generate a single page/form rather than the whole app (use scope=form with the page id)
14
+
15
+ DO NOT USE FOR:
16
+ - Previewing which files would be generated WITHOUT writing them -> use 'designer_preview_files'
17
+ - Validating that the UDF payload is structurally correct -> use 'designer_validate_payload'
18
+ - Initialising a new project from a plugin -> use 'designer_init_project'
19
+ - Creating a new custom plugin from a template -> use 'designer_scaffold_plugin'
20
+
21
+ This tool wraps the RESTForge Designer CLI command: restforge-designer generate --payload=<payload> --output=<output> [optional flags], run in the given cwd.
22
+ The --payload and --output flags are always sent so the binary never drops into interactive prompt mode. Optional flags (plugin override, overwrite, scope, page, skip shared, plugins dir, license) are forwarded only when supplied; the binary defaults to scope 'app' when --scope is omitted.
23
+ This operation is license-gated: the RESTForge Designer license must be active for generation to succeed.
24
+ The recommended flow is read-before-write (§5.3): validate the payload, then preview the files, then generate.
25
+
26
+ Preconditions:
27
+ - The 'restforge-designer' binary must be installed and reachable on PATH. This tool pre-checks that by running
28
+ 'restforge-designer --version'; if the binary is missing, the response will surface that as a non-error precondition.
29
+ - A valid, active RESTForge Designer license is required (the operation is license-gated).
30
+
31
+ PRESENTATION GUIDANCE:
32
+ - Match the user's language. If the user writes in Indonesian, respond in Indonesian.
33
+ - Never mention internal tool names in the reply to the user. Describe actions by what they do (e.g. "generate the frontend code", "validate the UI definition", "preview the generated files").
34
+ - Speak in plain language. Confirm what was generated and where; do not paste raw CLI output unless the user explicitly asks.
35
+ - When a precondition is not met, frame it as a question or next-step suggestion rather than an error.`,
36
+ inputSchema: {
37
+ cwd: z
38
+ .string()
39
+ .min(1)
40
+ .describe('Absolute path of the working directory where the binary is run'),
41
+ payload: z
42
+ .string()
43
+ .min(1)
44
+ .describe('Path to the UDF payload JSON file (relative to cwd or absolute). Required.'),
45
+ output: z
46
+ .string()
47
+ .min(1)
48
+ .describe('Path to the output folder where the frontend files will be written (relative to cwd or absolute). Required.'),
49
+ plugin: z
50
+ .string()
51
+ .min(1)
52
+ .optional()
53
+ .describe('Override the plugin id taken from the payload.'),
54
+ overwrite: z
55
+ .boolean()
56
+ .optional()
57
+ .describe('When true, overwrite existing files in the output directory.'),
58
+ scope: z
59
+ .enum(['app', 'form'])
60
+ .optional()
61
+ .describe('What to generate: the whole app or a single form/page. When omitted, the binary defaults to "app".'),
62
+ page: z
63
+ .string()
64
+ .min(1)
65
+ .optional()
66
+ .describe('The page/form id to generate, used with scope "form".'),
67
+ skipShared: z
68
+ .boolean()
69
+ .optional()
70
+ .describe('When true, skip generating the shared/common files.'),
71
+ pluginsDir: z
72
+ .string()
73
+ .min(1)
74
+ .optional()
75
+ .describe('Override path to the plugins folder. When omitted, the binary auto-detects the plugins directory.'),
76
+ license: z
77
+ .string()
78
+ .min(1)
79
+ .optional()
80
+ .describe('License key override for this license-gated operation. When omitted, the binary uses the activated license.'),
81
+ },
82
+ annotations: {
83
+ title: 'Generate Designer Frontend',
84
+ destructiveHint: false, // writes generated files; overwrites only when overwrite=true is supplied
85
+ idempotentHint: false, // each call regenerates files
86
+ },
87
+ }, async ({ cwd, payload, output, plugin, overwrite, scope, page, skipShared, pluginsDir, license, }) => {
88
+ const projectCwd = resolve(cwd);
89
+ // Precondition check: the restforge-designer binary must be reachable on PATH.
90
+ // Treated as a non-error precondition per the authoring guide §3.4.
91
+ const probe = await execProcess('restforge-designer', ['--version'], {
92
+ cwd: projectCwd,
93
+ timeout: 10_000,
94
+ });
95
+ if (!probe.success) {
96
+ return {
97
+ content: [
98
+ {
99
+ type: 'text',
100
+ text: `Precondition not met: the RESTForge Designer command-line tool is not installed or not on PATH.
101
+
102
+ Working directory: ${projectCwd}
103
+ Payload: ${payload}
104
+ Output: ${output}
105
+ Plugins dir: ${pluginsDir ?? 'auto-detect'}
106
+ Probe command: ${probe.command}
107
+ Exit code: ${probe.exitCode}
108
+
109
+ For the assistant:
110
+ - The user needs to install RESTForge Designer (and ensure it is on the system PATH) before frontend code can be generated.
111
+ - When explaining to the user, say something like "the RESTForge Designer tool isn't installed or isn't on your PATH yet — please install it and try again". Do not mention internal tool names.
112
+ - Once it is installed, retry generating the frontend code.`,
113
+ },
114
+ ],
115
+ isError: false, // per §3.4
116
+ };
117
+ }
118
+ // Always send the required flags (--payload, --output) so the binary never drops
119
+ // into interactive prompt mode. Forward optional flags only when supplied; --scope
120
+ // is omitted to keep the binary's "app" default. per §3.5 / D6
121
+ const args = ['generate', `--payload=${payload}`, `--output=${output}`];
122
+ if (plugin)
123
+ args.push(`--plugin=${plugin}`);
124
+ if (overwrite)
125
+ args.push('--overwrite');
126
+ if (scope)
127
+ args.push(`--scope=${scope}`);
128
+ if (page)
129
+ args.push(`--page=${page}`);
130
+ if (skipShared)
131
+ args.push('--skip-shared');
132
+ if (pluginsDir)
133
+ args.push(`--plugins-dir=${pluginsDir}`);
134
+ if (license)
135
+ args.push(`--license=${license}`);
136
+ const result = await execProcess('restforge-designer', args, {
137
+ cwd: projectCwd,
138
+ timeout: 120_000,
139
+ });
140
+ // D9: write tool. A non-zero exit (incl. -1 crash/timeout) means generation did not
141
+ // complete cleanly — files may be missing or partial, so the model needs to recover
142
+ // -> isError: true.
143
+ if (result.exitCode !== 0) {
144
+ const stderrBlock = result.stderr
145
+ ? `\n--- stderr ---\n${result.stderr}\n--- end stderr ---\n`
146
+ : '';
147
+ return {
148
+ content: [
149
+ {
150
+ type: 'text',
151
+ text: `Generating the frontend code did not complete.
152
+
153
+ Working directory: ${projectCwd}
154
+ Payload: ${payload}
155
+ Output: ${output}
156
+ Scope: ${scope ?? 'app (default)'}
157
+ Plugins dir: ${pluginsDir ?? 'auto-detect'}
158
+ Command: ${result.command}
159
+ Exit code: ${result.exitCode}
160
+
161
+ --- stdout ---
162
+ ${result.stdout}
163
+ --- end stdout ---
164
+ ${stderrBlock}
165
+ For the assistant:
166
+ - The generation did not finish successfully, so the output files may be missing or partial. Read the CLI output above and explain the most likely cause to the user in plain language. Common causes:
167
+ * The RESTForge Designer license is not active — this operation is license-gated. Suggest the user activate their RESTForge Designer license through the Designer desktop application or its own CLI, then retry. Do not name any internal tool.
168
+ * The UDF payload is invalid — suggest validating the payload first to pinpoint the structural errors, then retry.
169
+ * The payload relies on 'extends' / 'include' references — soft note: if the same payload passes validation but generation fails with an appConfig/plugin error (e.g. the plugin or app config "not found"), the payload may use 'extends' / 'include' that generate does not appear to merge the way validation does. As a possible workaround, suggest a self-contained payload (inline appConfig and pages) or an already-merged file. This is a tentative hint, not a guaranteed rule — do not state it as certain or tie it to a specific version.
170
+ * The payload file path is wrong / the file was not found — suggest checking the path.
171
+ * The plugin id in the payload (or the plugins directory) could not be resolved — suggest listing the available plugins.
172
+ * The output directory already exists and overwrite was not enabled — suggest retrying with overwrite, or choosing a different output path.
173
+ * Exit code -1 — the command crashed or timed out; offer to retry.
174
+ - Do not paste the raw CLI output unless the user explicitly asks. Do not mention internal tool names. Match the user's language.`,
175
+ },
176
+ ],
177
+ isError: true, // per §3.4 / D9 — write did not complete
178
+ };
179
+ }
180
+ // D9: success — exit 0. Labeled facts + fenced raw output per §3.5.
181
+ const stderrBlock = result.stderr
182
+ ? `\n--- stderr ---\n${result.stderr}\n--- end stderr ---\n`
183
+ : '';
184
+ return {
185
+ content: [
186
+ {
187
+ type: 'text',
188
+ text: `Frontend code generated successfully.
189
+
190
+ Working directory: ${projectCwd}
191
+ Payload: ${payload}
192
+ Output: ${output}
193
+ Scope: ${scope ?? 'app (default)'}
194
+ Plugins dir: ${pluginsDir ?? 'auto-detect'}
195
+ Command: ${result.command}
196
+ Exit code: ${result.exitCode}
197
+
198
+ --- stdout ---
199
+ ${result.stdout}
200
+ --- end stdout ---
201
+ ${stderrBlock}
202
+ For the assistant:
203
+ - Confirm to the user that the frontend code was generated. Mention the output location and the scope (whole app, or a single page/form) in plain language.
204
+ - Summarise what was produced from the CLI output (how many files, what kind) rather than pasting it.
205
+ - Suggest a sensible next step, e.g. running or inspecting the generated frontend.
206
+ - Do not paste the raw CLI output unless the user explicitly asks. Do not mention internal tool names. Match the user's language.`,
207
+ },
208
+ ],
209
+ };
210
+ });
211
+ }
212
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/tools/designer/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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,MAAM,CAAC,MAAM;YAC/B,CAAC,CAAC,qBAAqB,MAAM,CAAC,MAAM,wBAAwB;YAC5D,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;qBAEG,UAAU;WACpB,OAAO;UACR,MAAM;SACP,KAAK,IAAI,eAAe;eAClB,UAAU,IAAI,aAAa;WAC/B,MAAM,CAAC,OAAO;aACZ,MAAM,CAAC,QAAQ;;;EAG1B,MAAM,CAAC,MAAM;;EAEb,WAAW;;;;;kIAKqH;iBACvH;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerDesignerTools(server: McpServer): void;
@@ -0,0 +1,17 @@
1
+ import { registerDesignerValidatePayload } from './validate-payload.js';
2
+ import { registerDesignerPreviewFiles } from './preview-files.js';
3
+ import { registerDesignerListPlugins } from './list-plugins.js';
4
+ import { registerDesignerInspectPlugin } from './inspect-plugin.js';
5
+ import { registerDesignerScaffoldPlugin } from './scaffold-plugin.js';
6
+ import { registerDesignerInitProject } from './init-project.js';
7
+ import { registerDesignerGenerate } from './generate.js';
8
+ export function registerDesignerTools(server) {
9
+ registerDesignerValidatePayload(server);
10
+ registerDesignerPreviewFiles(server);
11
+ registerDesignerListPlugins(server);
12
+ registerDesignerInspectPlugin(server);
13
+ registerDesignerScaffoldPlugin(server);
14
+ registerDesignerInitProject(server);
15
+ registerDesignerGenerate(server);
16
+ }
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/designer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEzD,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,+BAA+B,CAAC,MAAM,CAAC,CAAC;IACxC,4BAA4B,CAAC,MAAM,CAAC,CAAC;IACrC,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpC,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,8BAA8B,CAAC,MAAM,CAAC,CAAC;IACvC,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpC,wBAAwB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerDesignerInitProject(server: McpServer): void;
@@ -0,0 +1,235 @@
1
+ import { z } from 'zod';
2
+ import { resolve } from 'node:path';
3
+ import { execProcess } from '../../lib/exec.js';
4
+ export function registerDesignerInitProject(server) {
5
+ server.registerTool('designer_init_project', {
6
+ title: 'Init Designer Project',
7
+ description: `Initialise a new frontend project from an existing RESTForge Designer plugin, by running restforge-designer init. This WRITES a new project scaffold (config + structure) to disk, ready for generating frontend code.
8
+
9
+ USE WHEN:
10
+ - The user asks to start/initialise a new frontend project based on a designer plugin
11
+ - The user asks things like "init project frontend baru", "scaffold aplikasi dari plugin designer", "mulai project frontend dengan plugin X", "init a new frontend project", "set up a designer project from plugin <id>", "buat project frontend dari plugin"
12
+ - The user has a plugin id in mind and wants the project skeleton (app config, auth settings, ports) created from it
13
+
14
+ DO NOT USE FOR:
15
+ - Generating frontend code from an existing UDF payload -> use 'designer_generate'
16
+ - Creating a brand new custom plugin from a template -> use 'designer_scaffold_plugin'
17
+ - Listing or inspecting available plugins -> use 'designer_list_plugins' / 'designer_inspect_plugin'
18
+
19
+ This tool wraps the RESTForge Designer CLI command: restforge-designer init --plugin=<plugin> --output=<output> [optional flags], run in the given cwd.
20
+ The --plugin and --output flags are always sent so the binary never drops into interactive prompt mode. Optional flags (app name/code, API URLs, auth settings, port, idle timeout, no-auth, overwrite, plugins dir, license) are forwarded only when supplied.
21
+ This operation is license-gated: the RESTForge Designer license must be active for init to succeed.
22
+
23
+ Preconditions:
24
+ - The 'restforge-designer' binary must be installed and reachable on PATH. This tool pre-checks that by running
25
+ 'restforge-designer --version'; if the binary is missing, the response will surface that as a non-error precondition.
26
+ - A valid, active RESTForge Designer license is required (the operation is license-gated).
27
+
28
+ PRESENTATION GUIDANCE:
29
+ - Match the user's language. If the user writes in Indonesian, respond in Indonesian.
30
+ - Never mention internal tool names in the reply to the user. Describe actions by what they do (e.g. "initialise the frontend project", "generate the frontend code", "scaffold a new plugin").
31
+ - Speak in plain language. Confirm what was created and where; do not paste raw CLI output unless the user explicitly asks.
32
+ - When a precondition is not met, frame it as a question or next-step suggestion rather than an error.`,
33
+ inputSchema: {
34
+ cwd: z
35
+ .string()
36
+ .min(1)
37
+ .describe('Absolute path of the working directory where the binary is run'),
38
+ plugin: z
39
+ .string()
40
+ .min(1)
41
+ .describe('The plugin id to initialise the project from (e.g. vanilla-js-basic). Required.'),
42
+ output: z
43
+ .string()
44
+ .min(1)
45
+ .describe('Path to the output folder where the project will be created (relative to cwd or absolute). Required.'),
46
+ appName: z
47
+ .string()
48
+ .min(1)
49
+ .optional()
50
+ .describe('Human-readable application name for the project.'),
51
+ appCode: z
52
+ .string()
53
+ .min(1)
54
+ .optional()
55
+ .describe('Short application code/identifier for the project.'),
56
+ apiBaseUrl: z
57
+ .string()
58
+ .min(1)
59
+ .optional()
60
+ .describe('Base URL of the backend API the frontend will call.'),
61
+ authAppCode: z
62
+ .string()
63
+ .min(1)
64
+ .optional()
65
+ .describe('Application code used for authentication.'),
66
+ authApiUrl: z
67
+ .string()
68
+ .min(1)
69
+ .optional()
70
+ .describe('Base URL of the authentication API.'),
71
+ port: z
72
+ .number()
73
+ .int()
74
+ .min(1024)
75
+ .max(65535)
76
+ .optional()
77
+ .describe('Dev server port for the project (1024-65535).'),
78
+ idleTimeout: z
79
+ .number()
80
+ .int()
81
+ .min(1)
82
+ .optional()
83
+ .describe('Idle timeout in seconds for the project.'),
84
+ noAuth: z
85
+ .boolean()
86
+ .optional()
87
+ .describe('When true, initialise the project without authentication.'),
88
+ overwrite: z
89
+ .boolean()
90
+ .optional()
91
+ .describe('When true, overwrite the output directory if it already exists.'),
92
+ pluginsDir: z
93
+ .string()
94
+ .min(1)
95
+ .optional()
96
+ .describe('Override path to the plugins folder. When omitted, the binary auto-detects the plugins directory.'),
97
+ license: z
98
+ .string()
99
+ .min(1)
100
+ .optional()
101
+ .describe('License key override for this license-gated operation. When omitted, the binary uses the activated license.'),
102
+ },
103
+ annotations: {
104
+ title: 'Init Designer Project',
105
+ destructiveHint: false, // creates a new project; overwrites only when overwrite=true is supplied
106
+ idempotentHint: false, // each call attempts to create/initialise a project
107
+ },
108
+ }, async ({ cwd, plugin, output, appName, appCode, apiBaseUrl, authAppCode, authApiUrl, port, idleTimeout, noAuth, overwrite, pluginsDir, license, }) => {
109
+ const projectCwd = resolve(cwd);
110
+ // Precondition check: the restforge-designer binary must be reachable on PATH.
111
+ // Treated as a non-error precondition per the authoring guide §3.4.
112
+ const probe = await execProcess('restforge-designer', ['--version'], {
113
+ cwd: projectCwd,
114
+ timeout: 10_000,
115
+ });
116
+ if (!probe.success) {
117
+ return {
118
+ content: [
119
+ {
120
+ type: 'text',
121
+ text: `Precondition not met: the RESTForge Designer command-line tool is not installed or not on PATH.
122
+
123
+ Working directory: ${projectCwd}
124
+ Plugin: ${plugin}
125
+ Output: ${output}
126
+ Plugins dir: ${pluginsDir ?? 'auto-detect'}
127
+ Probe command: ${probe.command}
128
+ Exit code: ${probe.exitCode}
129
+
130
+ For the assistant:
131
+ - The user needs to install RESTForge Designer (and ensure it is on the system PATH) before a project can be initialised.
132
+ - When explaining to the user, say something like "the RESTForge Designer tool isn't installed or isn't on your PATH yet — please install it and try again". Do not mention internal tool names.
133
+ - Once it is installed, retry initialising the project.`,
134
+ },
135
+ ],
136
+ isError: false, // per §3.4
137
+ };
138
+ }
139
+ // Always send the required flags (--plugin, --output) so the binary never drops
140
+ // into interactive prompt mode. Forward optional flags only when supplied. per §3.5 / D6
141
+ const args = ['init', `--plugin=${plugin}`, `--output=${output}`];
142
+ if (appName)
143
+ args.push(`--app-name=${appName}`);
144
+ if (appCode)
145
+ args.push(`--app-code=${appCode}`);
146
+ if (apiBaseUrl)
147
+ args.push(`--api-base-url=${apiBaseUrl}`);
148
+ if (authAppCode)
149
+ args.push(`--auth-app-code=${authAppCode}`);
150
+ if (authApiUrl)
151
+ args.push(`--auth-api-url=${authApiUrl}`);
152
+ if (port !== undefined)
153
+ args.push(`--port=${port}`);
154
+ if (idleTimeout !== undefined)
155
+ args.push(`--idle-timeout=${idleTimeout}`);
156
+ if (noAuth)
157
+ args.push('--no-auth');
158
+ if (overwrite)
159
+ args.push('--overwrite');
160
+ if (pluginsDir)
161
+ args.push(`--plugins-dir=${pluginsDir}`);
162
+ if (license)
163
+ args.push(`--license=${license}`);
164
+ const result = await execProcess('restforge-designer', args, {
165
+ cwd: projectCwd,
166
+ timeout: 60_000,
167
+ });
168
+ // D9: write tool. A non-zero exit (incl. -1 crash/timeout) means the init did not
169
+ // complete cleanly — the project may be missing or partial, so the model needs to
170
+ // recover -> isError: true.
171
+ if (result.exitCode !== 0) {
172
+ const stderrBlock = result.stderr
173
+ ? `\n--- stderr ---\n${result.stderr}\n--- end stderr ---\n`
174
+ : '';
175
+ return {
176
+ content: [
177
+ {
178
+ type: 'text',
179
+ text: `Initialising the Designer project did not complete.
180
+
181
+ Working directory: ${projectCwd}
182
+ Plugin: ${plugin}
183
+ Output: ${output}
184
+ Plugins dir: ${pluginsDir ?? 'auto-detect'}
185
+ Command: ${result.command}
186
+ Exit code: ${result.exitCode}
187
+
188
+ --- stdout ---
189
+ ${result.stdout}
190
+ --- end stdout ---
191
+ ${stderrBlock}
192
+ For the assistant:
193
+ - The init did not finish successfully, so the project may not exist or may be partial. Read the CLI output above and explain the most likely cause to the user in plain language. Common causes:
194
+ * The RESTForge Designer license is not active — this operation is license-gated. Suggest the user activate their RESTForge Designer license through the Designer desktop application or its own CLI, then retry. Do not name any internal tool.
195
+ * The output directory already exists and overwrite was not enabled — suggest retrying with overwrite, or choosing a different output path.
196
+ * The plugin id does not exist — suggest listing the available plugins to pick a valid id.
197
+ * The chosen plugin does not support init — soft note: not every plugin supports the 'init' feature. If the CLI says something like "does not support the init feature", suggest picking a plugin that does (the available plugins can be listed to find one). Do not hardcode or assert a permanent list of which plugins support init — treat it as something to confirm from the current plugin list rather than a fixed claim.
198
+ * Exit code -1 — the command crashed or timed out; offer to retry.
199
+ - Do not paste the raw CLI output unless the user explicitly asks. Do not mention internal tool names. Match the user's language.`,
200
+ },
201
+ ],
202
+ isError: true, // per §3.4 / D9 — write did not complete
203
+ };
204
+ }
205
+ // D9: success — exit 0. Labeled facts + fenced raw output per §3.5.
206
+ const stderrBlock = result.stderr
207
+ ? `\n--- stderr ---\n${result.stderr}\n--- end stderr ---\n`
208
+ : '';
209
+ return {
210
+ content: [
211
+ {
212
+ type: 'text',
213
+ text: `Designer project initialised successfully.
214
+
215
+ Working directory: ${projectCwd}
216
+ Plugin: ${plugin}
217
+ Output: ${output}
218
+ Plugins dir: ${pluginsDir ?? 'auto-detect'}
219
+ Command: ${result.command}
220
+ Exit code: ${result.exitCode}
221
+
222
+ --- stdout ---
223
+ ${result.stdout}
224
+ --- end stdout ---
225
+ ${stderrBlock}
226
+ For the assistant:
227
+ - Confirm to the user that the frontend project was initialised. Mention the plugin and the output location in plain language.
228
+ - Suggest the next step: author or supply a UDF payload and then generate the frontend code into the project. The usual flow is validate the payload, preview the files, then generate.
229
+ - Do not paste the raw CLI output unless the user explicitly asks. Do not mention internal tool names. Match the user's language.`,
230
+ },
231
+ ],
232
+ };
233
+ });
234
+ }
235
+ //# sourceMappingURL=init-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-project.js","sourceRoot":"","sources":["../../../src/tools/designer/init-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,2BAA2B,CAAC,MAAiB;IAC3D,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;uGAyBoF;QACjG,WAAW,EAAE;YACX,GAAG,EAAE,CAAC;iBACH,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,gEAAgE,CAAC;YAC7E,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,iFAAiF,CAAC;YAC9F,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CAAC,sGAAsG,CAAC;YACnH,OAAO,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,EAAE;iBACV,QAAQ,CAAC,kDAAkD,CAAC;YAC/D,OAAO,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,EAAE;iBACV,QAAQ,CAAC,oDAAoD,CAAC;YACjE,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,EAAE;iBACV,QAAQ,CA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MAAM,wBAAwB;YAC5D,CAAC,CAAC,EAAE,CAAC;QACP,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;qBAEG,UAAU;UACrB,MAAM;UACN,MAAM;eACD,UAAU,IAAI,aAAa;WAC/B,MAAM,CAAC,OAAO;aACZ,MAAM,CAAC,QAAQ;;;EAG1B,MAAM,CAAC,MAAM;;EAEb,WAAW;;;;kIAIqH;iBACvH;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerDesignerInspectPlugin(server: McpServer): void;