@guren/server 2.9.0 → 2.10.1

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 (92) hide show
  1. package/dist/DocsViewerServiceProvider-qFCaeiUv.js +77 -0
  2. package/dist/Hash-CzrwKeDp.js +133 -0
  3. package/dist/HttpException-BkS3euNG.js +161 -0
  4. package/dist/Job-BVT813DO.js +441 -0
  5. package/dist/McpServiceProvider-BoAN-UcD.js +367 -0
  6. package/dist/MessageSigner-Bd25ZJAV.js +93 -0
  7. package/dist/Random-DbIJ22KQ.js +191 -0
  8. package/dist/address-D0Iq-XIH.js +20 -0
  9. package/dist/auth/index.js +2 -122
  10. package/dist/auth-C7sVmYgc.js +1954 -0
  11. package/dist/authorization/index.js +2 -38
  12. package/dist/authorization-Dbcuc5ZK.js +610 -0
  13. package/dist/broadcasting/index.js +2 -26
  14. package/dist/broadcasting-Dw-FhyjN.js +1055 -0
  15. package/dist/cache/index.js +2 -17
  16. package/dist/cache/types.d.ts +4 -4
  17. package/dist/cache-BYnZf2FR.js +812 -0
  18. package/dist/client-Dd7vLcqp.js +27 -0
  19. package/dist/console/Output.d.ts +18 -18
  20. package/dist/discovery/AutoDiscovery.d.ts +8 -0
  21. package/dist/encryption/index.js +5 -96
  22. package/dist/encryption-fOWQaKqX.js +250 -0
  23. package/dist/endpoint-D-20PiHY.js +46 -0
  24. package/dist/endpoint-D6GIqOpe.js +31 -0
  25. package/dist/errors-quJOkkCn.js +81 -0
  26. package/dist/events/index.js +2 -28
  27. package/dist/events-aIH_bWRx.js +410 -0
  28. package/dist/health/index.js +2 -24
  29. package/dist/health-VWdWXRwh.js +345 -0
  30. package/dist/hot-disposables-WsTX2ySN.js +281 -0
  31. package/dist/hot-reload/testing.d.ts +1 -1
  32. package/dist/http/Application.d.ts +0 -1
  33. package/dist/i18n/index.js +2 -30
  34. package/dist/i18n-mcWi7LCd.js +617 -0
  35. package/dist/index.js +7496 -7281
  36. package/dist/lambda/index.js +114 -71
  37. package/dist/logging/index.js +2 -24
  38. package/dist/logging-CPaRMuPP.js +518 -0
  39. package/dist/loopback-guard-D0Kc7-xc.js +224 -0
  40. package/dist/mail/index.js +2 -27
  41. package/dist/mail-DfEfSQEr.js +699 -0
  42. package/dist/mcp/index.js +2 -10
  43. package/dist/notifications/index.js +2 -33
  44. package/dist/notifications-BGqmUNZ8.js +759 -0
  45. package/dist/queue/index.js +3 -42
  46. package/dist/queue-CXrRK85G.js +948 -0
  47. package/dist/redis/index.js +672 -642
  48. package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
  49. package/dist/runtime/index.js +474 -604
  50. package/dist/scheduling/index.js +2 -29
  51. package/dist/scheduling-CPiEdtQd.js +839 -0
  52. package/dist/storage/index.js +2 -15
  53. package/dist/storage-tWHMv2H_.js +841 -0
  54. package/dist/support/expiry.js +69 -12
  55. package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
  56. package/dist/vite/index.js +118 -181
  57. package/dist/vite/plugin.d.ts +1 -1
  58. package/dist/vite-dev-server-CpCUqmiC.js +131 -0
  59. package/package.json +6 -5
  60. package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
  61. package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
  62. package/dist/chunk-2SC566CD.js +0 -376
  63. package/dist/chunk-2V3YID4H.js +0 -20
  64. package/dist/chunk-3KV5X2FL.js +0 -31
  65. package/dist/chunk-63SKW5PS.js +0 -457
  66. package/dist/chunk-6J6B5KOB.js +0 -425
  67. package/dist/chunk-A5JJ7XTH.js +0 -24
  68. package/dist/chunk-AZOYI43J.js +0 -18
  69. package/dist/chunk-B5E5VBDI.js +0 -115
  70. package/dist/chunk-DAQKYKLH.js +0 -182
  71. package/dist/chunk-DRNPVBAA.js +0 -1002
  72. package/dist/chunk-EI5GYMAT.js +0 -853
  73. package/dist/chunk-H3B23O6T.js +0 -271
  74. package/dist/chunk-HPET6XY5.js +0 -853
  75. package/dist/chunk-HR2KZ3WL.js +0 -616
  76. package/dist/chunk-IOTWFHZU.js +0 -558
  77. package/dist/chunk-K6CUBJX6.js +0 -642
  78. package/dist/chunk-KTNJG7R7.js +0 -911
  79. package/dist/chunk-LAJQCSSF.js +0 -355
  80. package/dist/chunk-LHR6OHI7.js +0 -189
  81. package/dist/chunk-N7PLD7MB.js +0 -729
  82. package/dist/chunk-O5XIXGYM.js +0 -274
  83. package/dist/chunk-Q2P6YLRR.js +0 -24
  84. package/dist/chunk-QQKTH5KX.js +0 -114
  85. package/dist/chunk-SFQP6O52.js +0 -126
  86. package/dist/chunk-SQR7277M.js +0 -911
  87. package/dist/chunk-T2FFUU6J.js +0 -484
  88. package/dist/chunk-TVV5YNEC.js +0 -1842
  89. package/dist/chunk-UY3AZSYL.js +0 -14
  90. package/dist/chunk-V4DNC2ER.js +0 -114
  91. package/dist/chunk-YSOJKAAU.js +0 -427
  92. package/dist/errors-PUNHAFL2.js +0 -34
@@ -1,14 +0,0 @@
1
- // src/redis/client.ts
2
- import Redis from "ioredis";
3
- function createRedisClient(options = {}) {
4
- const { url, ...redisOptions } = options;
5
- if (url) {
6
- return new Redis(url, redisOptions);
7
- }
8
- return new Redis(redisOptions);
9
- }
10
-
11
- export {
12
- Redis,
13
- createRedisClient
14
- };
@@ -1,114 +0,0 @@
1
- // src/encryption/Random.ts
2
- import { randomBytes, randomUUID, randomInt as cryptoRandomInt } from "crypto";
3
- var CHARSETS = {
4
- alphanumeric: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
5
- alphabetic: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
6
- numeric: "0123456789",
7
- hex: "0123456789abcdef",
8
- "base64": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
9
- "url-safe": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
10
- };
11
- function unbiasedRandomChars(length, chars) {
12
- if (!Number.isInteger(length) || length < 0) {
13
- throw new RangeError(`Random string length must be a non-negative integer, received ${length}.`);
14
- }
15
- const limit = 256 - 256 % chars.length;
16
- let result = "";
17
- while (result.length < length) {
18
- const remaining = length - result.length;
19
- const bytes = randomBytes(Math.ceil(remaining * 256 / limit) + 8);
20
- for (const byte of bytes) {
21
- if (byte < limit) {
22
- result += chars[byte % chars.length];
23
- if (result.length === length) break;
24
- }
25
- }
26
- }
27
- return result;
28
- }
29
- function randomString(length, options = {}) {
30
- const { charset = "alphanumeric" } = options;
31
- return unbiasedRandomChars(length, CHARSETS[charset]);
32
- }
33
- function random(length) {
34
- return randomBytes(length);
35
- }
36
- function randomHex(length) {
37
- return randomBytes(length).toString("hex");
38
- }
39
- function randomBase64(length) {
40
- return randomBytes(length).toString("base64");
41
- }
42
- function randomBase64Url(length) {
43
- return randomBytes(length).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
44
- }
45
- function uuid() {
46
- return randomUUID();
47
- }
48
- function randomInt(min, max) {
49
- return cryptoRandomInt(min, max + 1);
50
- }
51
- function urlSafeToken(length = 32) {
52
- return randomBase64Url(Math.ceil(length * 0.75)).slice(0, length);
53
- }
54
- function generatePassword(length = 16, options = {}) {
55
- const {
56
- uppercase = true,
57
- lowercase = true,
58
- numbers = true,
59
- symbols = true
60
- } = options;
61
- let chars = "";
62
- if (uppercase) chars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
63
- if (lowercase) chars += "abcdefghijklmnopqrstuvwxyz";
64
- if (numbers) chars += "0123456789";
65
- if (symbols) chars += "!@#$%^&*()-_=+[]{}|;:,.<>?";
66
- if (chars.length === 0) {
67
- chars = CHARSETS.alphanumeric;
68
- }
69
- return unbiasedRandomChars(length, chars);
70
- }
71
- function generateOtp(length = 6) {
72
- return randomString(length, { charset: "numeric" });
73
- }
74
- function generateSlug(length = 10) {
75
- return randomString(length, { charset: "hex" });
76
- }
77
- function shuffle(array) {
78
- const result = [...array];
79
- for (let i = result.length - 1; i > 0; i--) {
80
- const j = randomInt(0, i);
81
- [result[i], result[j]] = [result[j], result[i]];
82
- }
83
- return result;
84
- }
85
- function pick(array) {
86
- if (array.length === 0) {
87
- throw new Error("Cannot pick from empty array.");
88
- }
89
- return array[randomInt(0, array.length - 1)];
90
- }
91
- function sample(array, count) {
92
- if (count > array.length) {
93
- throw new Error("Sample count exceeds array length.");
94
- }
95
- const shuffled = shuffle(array);
96
- return shuffled.slice(0, count);
97
- }
98
-
99
- export {
100
- randomString,
101
- random,
102
- randomHex,
103
- randomBase64,
104
- randomBase64Url,
105
- uuid,
106
- randomInt,
107
- urlSafeToken,
108
- generatePassword,
109
- generateOtp,
110
- generateSlug,
111
- shuffle,
112
- pick,
113
- sample
114
- };
@@ -1,427 +0,0 @@
1
- import {
2
- MCP_ENDPOINT_PATH,
3
- createMcpAccessGuard,
4
- isMcpEndpointEnabled
5
- } from "./chunk-Q2P6YLRR.js";
6
- import {
7
- ServiceProvider
8
- } from "./chunk-LHR6OHI7.js";
9
-
10
- // src/mcp/create-mcp-server.ts
11
- import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
12
- import { z } from "zod";
13
- function createMcpServer(options) {
14
- const { cwd, cli, version = "0.2.0" } = options;
15
- const server = new McpServer({
16
- name: "guren",
17
- version
18
- });
19
- server.tool(
20
- "guren_get_context",
21
- "Get a complete project context map including models, routes, pages, controllers, resources, events, jobs, middleware, listeners, and validators.",
22
- {
23
- format: z.enum(["json", "markdown"]).default("json").describe("Output format")
24
- },
25
- async ({ format }) => {
26
- const ctx = await cli.generateContext({ cwd });
27
- const text = format === "markdown" ? cli.renderContextMarkdown(ctx) : JSON.stringify(ctx, null, 2);
28
- return { content: [{ type: "text", text }] };
29
- }
30
- );
31
- server.tool(
32
- "guren_entity_context",
33
- "Get everything about one entity in a single bundle: model (table, columns, relationships, reverse references), routes with validation schemas, controller actions, Inertia pages with props, resource, policy, seeders, and tests. Prefer this over guren_get_context when working on a specific model.",
34
- {
35
- entity: z.string().describe('Model class name (e.g., "User"). Case-insensitive.'),
36
- module: z.string().optional().describe('Module name to disambiguate same-named models across modules/; "app" selects the application root'),
37
- format: z.enum(["json", "markdown"]).default("markdown").describe("Output format")
38
- },
39
- async ({ entity, module, format }) => {
40
- try {
41
- const ctx = await cli.generateEntityContext(entity, { cwd, module });
42
- const text = format === "markdown" ? cli.renderEntityContextMarkdown(ctx) : JSON.stringify(ctx, null, 2);
43
- return { content: [{ type: "text", text }] };
44
- } catch (error) {
45
- return {
46
- content: [
47
- { type: "text", text: error instanceof Error ? error.message : String(error) }
48
- ],
49
- isError: true
50
- };
51
- }
52
- }
53
- );
54
- if (cli.buildDocsGraphReport && cli.renderDocsGraphMarkdown) {
55
- const { buildDocsGraphReport, renderDocsGraphMarkdown } = cli;
56
- server.tool(
57
- "guren_docs_graph",
58
- 'The OKF docs relation graph: documents, entities, and code paths as nodes, verified relations (governs, body links, spec-view derivation) as edges. Narrow with entity or path to answer "which docs govern this, and which spec views regenerate from it?" BEFORE renaming or editing a file \u2014 guren_check only reports the breakage afterwards.',
59
- {
60
- entity: z.string().optional().describe("Narrow to the neighborhood of one model entity (case-insensitive)."),
61
- path: z.string().optional().describe('Narrow to the neighborhood of one app-root-relative path (e.g. "app/Http/Controllers/PostController.ts").'),
62
- format: z.enum(["json", "markdown"]).default("markdown").describe("Output format")
63
- },
64
- async ({ entity, path, format }) => {
65
- const report = await buildDocsGraphReport({ cwd, entity, path });
66
- const text = format === "markdown" ? renderDocsGraphMarkdown(report) : JSON.stringify(report, null, 2);
67
- return { content: [{ type: "text", text }] };
68
- }
69
- );
70
- }
71
- server.tool(
72
- "guren_check",
73
- "Validate route-to-controller-to-page consistency, check for empty controller methods, missing test files, and missing generated manifests.",
74
- {},
75
- async () => {
76
- const report = await cli.runCheck({ cwd });
77
- return { content: [{ type: "text", text: JSON.stringify(report, null, 2) }] };
78
- }
79
- );
80
- server.tool(
81
- "guren_list_models",
82
- "List all models with their table names, relationships, authentication trait, and soft deletes status.",
83
- {},
84
- async () => {
85
- const models = await cli.listModels({ appRoot: cwd });
86
- return { content: [{ type: "text", text: JSON.stringify(models, null, 2) }] };
87
- }
88
- );
89
- server.tool(
90
- "guren_generate_guidelines",
91
- "Generate project-specific coding guidelines based on the current project structure, naming conventions, auth setup, models, validation patterns, and middleware.",
92
- {},
93
- async () => {
94
- const guidelines = await cli.generateGuidelines({ cwd });
95
- return { content: [{ type: "text", text: guidelines }] };
96
- }
97
- );
98
- server.tool(
99
- "guren_doctor",
100
- "Run a comprehensive health check on the Guren project and optionally suggest actionable next steps.",
101
- {
102
- next: z.boolean().default(false).describe("Include actionable next steps")
103
- },
104
- async ({ next }) => {
105
- const report = await cli.runDoctor({ cwd });
106
- let text = JSON.stringify(report, null, 2);
107
- if (next) {
108
- const steps = await cli.suggestNextSteps({ cwd });
109
- text = JSON.stringify({ ...report, nextSteps: steps }, null, 2);
110
- }
111
- return { content: [{ type: "text", text }] };
112
- }
113
- );
114
- server.tool(
115
- "guren_make_feature",
116
- "Generate a complete CRUD feature: controller, model, views (Index, Show, New, Edit), validator, and resource. Optionally include test file.",
117
- {
118
- name: z.string().describe('Resource name in PascalCase (e.g., "Post", "BlogComment")'),
119
- fields: z.string().optional().describe(
120
- 'Comma-separated field definitions (e.g., "title:string,body:text,published:boolean")'
121
- ),
122
- withTest: z.boolean().default(false).describe("Generate test file"),
123
- force: z.boolean().default(false).describe("Overwrite existing files")
124
- },
125
- async ({ name, fields, withTest, force }) => {
126
- const createdFiles = await cli.makeFeature(name, { fields, withTest, force, cwd });
127
- return {
128
- content: [{ type: "text", text: JSON.stringify({ created: createdFiles }, null, 2) }]
129
- };
130
- }
131
- );
132
- server.tool(
133
- "guren_make_component",
134
- "Generate a single component: controller, model, middleware, event, job, listener, resource, view, test, mail, notification, seeder, factory, or migration.",
135
- {
136
- type: z.enum([
137
- "controller",
138
- "model",
139
- "middleware",
140
- "event",
141
- "job",
142
- "listener",
143
- "resource",
144
- "view",
145
- "test",
146
- "mail",
147
- "notification",
148
- "seeder",
149
- "factory",
150
- "provider",
151
- "exception",
152
- "command",
153
- "channel"
154
- ]).describe("Component type to generate"),
155
- name: z.string().describe("Component name in PascalCase"),
156
- force: z.boolean().default(false).describe("Overwrite existing files")
157
- },
158
- async ({ type, name, force }) => {
159
- const makers = {
160
- controller: cli.makeController,
161
- model: cli.makeModel,
162
- view: cli.makeView,
163
- test: cli.makeTest,
164
- route: cli.makeRoute
165
- };
166
- const maker = makers[type];
167
- if (!maker) {
168
- return {
169
- content: [
170
- {
171
- type: "text",
172
- text: `Component type "${type}" is not yet supported via MCP. Use the CLI: bunx guren make:${type} ${name}`
173
- }
174
- ],
175
- isError: true
176
- };
177
- }
178
- const result = await maker(name, { force, cwd });
179
- const created = Array.isArray(result) ? result : [result];
180
- return {
181
- content: [{ type: "text", text: JSON.stringify({ created }, null, 2) }]
182
- };
183
- }
184
- );
185
- server.tool(
186
- "guren_codegen",
187
- "Generate the type-safe route, page, data, and channel manifests plus the API client (.guren/ and types/generated/).",
188
- {},
189
- async () => {
190
- const options2 = { cwd, force: true };
191
- const generated = [];
192
- const skipped = [];
193
- const warnings = [];
194
- let failed = false;
195
- const run = async (artifacts, generate) => {
196
- try {
197
- const result = await generate();
198
- if (result?.outputPath === "") {
199
- skipped.push({ artifacts, reason: result.skipped?.message ?? "nothing to generate" });
200
- } else {
201
- generated.push(...artifacts);
202
- }
203
- if (result?.warnings) warnings.push(...result.warnings);
204
- return result;
205
- } catch (error) {
206
- failed = true;
207
- skipped.push({
208
- artifacts,
209
- reason: error instanceof Error ? error.message : String(error)
210
- });
211
- }
212
- };
213
- const routes = await run(
214
- [".guren/routes.gen.ts", "types/generated/routes.d.ts"],
215
- () => cli.generateRouteTypes(options2)
216
- );
217
- await run([".guren/pages.gen.ts"], () => cli.generatePageTypes(options2));
218
- const data = await run([".guren/data.gen.ts"], () => cli.generateDataTypes(options2));
219
- await run([".guren/channels.gen.ts"], () => cli.generateChannelTypes(options2));
220
- await run([".guren/api-client.gen.ts"], () => {
221
- if (!routes?.definitions) {
222
- throw new Error("route generation produced no manifest to build a client from");
223
- }
224
- return cli.generateApiClientTypes(routes.definitions, { ...options2, resources: data?.definitions });
225
- });
226
- return {
227
- content: [{ type: "text", text: JSON.stringify({ generated, skipped, warnings }, null, 2) }],
228
- // A generator that found nothing to describe is not a failure — an
229
- // app with no page components is a normal shape — so only a thrown
230
- // one makes the run an error, even when other artifacts landed.
231
- isError: failed
232
- };
233
- }
234
- );
235
- server.resource(
236
- "context",
237
- "guren://context",
238
- {
239
- description: "Current project structure map (models, routes, pages, controllers, etc.)",
240
- mimeType: "application/json"
241
- },
242
- async (uri) => {
243
- const ctx = await cli.generateContext({ cwd });
244
- return {
245
- contents: [
246
- {
247
- uri: uri.href,
248
- mimeType: "application/json",
249
- text: JSON.stringify(ctx, null, 2)
250
- }
251
- ]
252
- };
253
- }
254
- );
255
- server.resource(
256
- "entity-context",
257
- new ResourceTemplate("guren://context/{entity}", { list: void 0 }),
258
- {
259
- description: "Entity-centric context bundle: model, routes, controller, pages, resource, policy. For same-named models across modules, use the guren_entity_context tool with its module argument instead.",
260
- mimeType: "text/markdown"
261
- },
262
- async (uri, variables) => {
263
- const ctx = await cli.generateEntityContext(String(variables.entity), { cwd });
264
- return {
265
- contents: [
266
- {
267
- uri: uri.href,
268
- mimeType: "text/markdown",
269
- text: cli.renderEntityContextMarkdown(ctx)
270
- }
271
- ]
272
- };
273
- }
274
- );
275
- server.resource(
276
- "guidelines",
277
- "guren://guidelines",
278
- {
279
- description: "Auto-generated project-specific coding guidelines",
280
- mimeType: "text/markdown"
281
- },
282
- async (uri) => {
283
- const guidelines = await cli.generateGuidelines({ cwd });
284
- return {
285
- contents: [
286
- {
287
- uri: uri.href,
288
- mimeType: "text/markdown",
289
- text: guidelines
290
- }
291
- ]
292
- };
293
- }
294
- );
295
- server.prompt(
296
- "guren_review",
297
- "Review code changes against project conventions and patterns. Automatically fetches project context and runs integrity checks first.",
298
- async () => {
299
- let contextSummary;
300
- try {
301
- const ctx = await cli.generateContext({ cwd });
302
- const check = await cli.runCheck({ cwd });
303
- contextSummary = [
304
- "## Project Context",
305
- `Framework: ${ctx.framework.name} v${ctx.framework.version}`,
306
- `Models: ${ctx.models.map((m) => m.className).join(", ") || "none"}`,
307
- `Controllers: ${ctx.controllers.join(", ") || "none"}`,
308
- `Pages: ${ctx.pages.join(", ") || "none"}`,
309
- "",
310
- "## Integrity Check",
311
- `Pass: ${check.passCount}, Warn: ${check.warnCount}, Fail: ${check.failCount}`,
312
- ...check.checks.filter((c) => c.status !== "pass").map((c) => `- [${c.status}] ${c.title}: ${c.message}`)
313
- ].join("\n");
314
- } catch {
315
- contextSummary = "Could not load project context.";
316
- }
317
- return {
318
- messages: [
319
- {
320
- role: "user",
321
- content: {
322
- type: "text",
323
- text: [
324
- "Review the recent code changes in this Guren project.",
325
- "Check for:",
326
- "1. Adherence to project naming conventions and patterns",
327
- "2. Route-controller-page consistency",
328
- "3. Missing validation schemas",
329
- "4. Missing tests for new controllers",
330
- "5. Proper use of Model API (findOrFail, relationships)",
331
- "",
332
- contextSummary
333
- ].join("\n")
334
- }
335
- }
336
- ]
337
- };
338
- }
339
- );
340
- server.prompt(
341
- "guren_plan_feature",
342
- "Plan a new feature given the current project structure. Provide the feature description as an argument.",
343
- { feature: z.string().describe("Description of the feature to plan") },
344
- async ({ feature }) => {
345
- let contextSummary;
346
- try {
347
- const ctx = await cli.generateContext({ cwd });
348
- const models = await cli.listModels({ appRoot: cwd });
349
- contextSummary = [
350
- "## Current Project State",
351
- `Models: ${models.map((m) => `${m.className}${m.tableName ? ` (${m.tableName})` : ""}`).join(", ") || "none"}`,
352
- `Controllers: ${ctx.controllers.join(", ") || "none"}`,
353
- `Routes: ${ctx.routes.length} defined`,
354
- `Pages: ${ctx.pages.join(", ") || "none"}`,
355
- "",
356
- "## Model Relationships",
357
- ...models.flatMap(
358
- (m) => m.relationships.length > 0 ? [
359
- `${m.className}: ${m.relationships.map((r) => `${r.type}(${r.name})`).join(", ")}`
360
- ] : []
361
- )
362
- ].join("\n");
363
- } catch {
364
- contextSummary = "Could not load project context.";
365
- }
366
- return {
367
- messages: [
368
- {
369
- role: "user",
370
- content: {
371
- type: "text",
372
- text: [
373
- `Plan the implementation of: ${feature}`,
374
- "",
375
- "Provide:",
376
- "1. Which files to create/modify",
377
- "2. Database schema changes (migration)",
378
- "3. Model definition with relationships",
379
- "4. Controller actions and validation schemas",
380
- "5. Inertia page components",
381
- "6. Route definitions",
382
- "7. Test plan",
383
- "",
384
- contextSummary
385
- ].join("\n")
386
- }
387
- }
388
- ]
389
- };
390
- }
391
- );
392
- return server;
393
- }
394
-
395
- // src/mcp/McpServiceProvider.ts
396
- var McpServiceProvider = class extends ServiceProvider {
397
- register() {
398
- }
399
- async boot() {
400
- if (!isMcpEndpointEnabled()) {
401
- return;
402
- }
403
- const app = this.container.make("app");
404
- const hono = app.hono;
405
- const cwd = process.cwd();
406
- const [{ WebStandardStreamableHTTPServerTransport }, cli] = await Promise.all([
407
- import("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js"),
408
- // @ts-ignore — @guren/cli is available at runtime via the app's dependencies
409
- import("@guren/cli")
410
- ]);
411
- const routeAwareCli = cli.createFreshContextApi ? { ...cli, ...cli.createFreshContextApi() } : cli;
412
- hono.use(MCP_ENDPOINT_PATH, createMcpAccessGuard());
413
- hono.all(MCP_ENDPOINT_PATH, async (c) => {
414
- const mcpServer = createMcpServer({ cwd, cli: routeAwareCli });
415
- const transport = new WebStandardStreamableHTTPServerTransport({
416
- sessionIdGenerator: void 0
417
- });
418
- await mcpServer.connect(transport);
419
- return transport.handleRequest(c.req.raw);
420
- });
421
- }
422
- };
423
-
424
- export {
425
- createMcpServer,
426
- McpServiceProvider
427
- };
@@ -1,34 +0,0 @@
1
- import {
2
- AuthorizationException,
3
- ExceptionHandler,
4
- MethodNotAllowedException,
5
- NotFoundHttpException,
6
- ValidationException,
7
- abort,
8
- abortIf,
9
- abortUnless,
10
- createExceptionHandler,
11
- getExceptionHandler,
12
- renderErrorPage,
13
- setExceptionHandler
14
- } from "./chunk-63SKW5PS.js";
15
- import {
16
- AuthenticationException,
17
- HttpException
18
- } from "./chunk-DAQKYKLH.js";
19
- export {
20
- AuthenticationException,
21
- AuthorizationException,
22
- ExceptionHandler,
23
- HttpException,
24
- MethodNotAllowedException,
25
- NotFoundHttpException,
26
- ValidationException,
27
- abort,
28
- abortIf,
29
- abortUnless,
30
- createExceptionHandler,
31
- getExceptionHandler,
32
- renderErrorPage,
33
- setExceptionHandler
34
- };