@guren/server 2.10.0 → 2.11.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/DocsViewerServiceProvider-qFCaeiUv.js +77 -0
- package/dist/Hash-CzrwKeDp.js +133 -0
- package/dist/HttpException-BkS3euNG.js +161 -0
- package/dist/Job-BVT813DO.js +441 -0
- package/dist/McpServiceProvider-BoAN-UcD.js +367 -0
- package/dist/MessageSigner-Bd25ZJAV.js +93 -0
- package/dist/Random-DbIJ22KQ.js +191 -0
- package/dist/address-D0Iq-XIH.js +20 -0
- package/dist/auth/index.js +2 -122
- package/dist/auth-C7sVmYgc.js +1954 -0
- package/dist/authorization/index.js +2 -38
- package/dist/authorization-Dbcuc5ZK.js +610 -0
- package/dist/broadcasting/index.js +2 -26
- package/dist/broadcasting-Dw-FhyjN.js +1055 -0
- package/dist/cache/index.js +2 -17
- package/dist/cache/types.d.ts +4 -4
- package/dist/cache-BYnZf2FR.js +812 -0
- package/dist/client-Dd7vLcqp.js +27 -0
- package/dist/console/Output.d.ts +18 -18
- package/dist/encryption/index.js +5 -96
- package/dist/encryption-fOWQaKqX.js +250 -0
- package/dist/endpoint-D-20PiHY.js +46 -0
- package/dist/endpoint-D6GIqOpe.js +31 -0
- package/dist/errors-quJOkkCn.js +81 -0
- package/dist/events/index.js +2 -28
- package/dist/events-aIH_bWRx.js +410 -0
- package/dist/health/index.js +2 -24
- package/dist/health-VWdWXRwh.js +345 -0
- package/dist/hot-disposables-WsTX2ySN.js +281 -0
- package/dist/hot-reload/testing.d.ts +1 -1
- package/dist/http/resources/Resource.d.ts +23 -3
- package/dist/i18n/index.js +2 -30
- package/dist/i18n-mcWi7LCd.js +617 -0
- package/dist/index.js +7515 -7276
- package/dist/lambda/index.js +114 -71
- package/dist/logging/index.js +2 -24
- package/dist/logging-CPaRMuPP.js +518 -0
- package/dist/loopback-guard-D0Kc7-xc.js +224 -0
- package/dist/mail/index.js +2 -27
- package/dist/mail-DfEfSQEr.js +699 -0
- package/dist/mcp/index.js +2 -10
- package/dist/notifications/index.js +2 -33
- package/dist/notifications-BGqmUNZ8.js +759 -0
- package/dist/queue/index.js +3 -42
- package/dist/queue-CXrRK85G.js +948 -0
- package/dist/redis/index.js +672 -642
- package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
- package/dist/runtime/index.js +472 -616
- package/dist/scheduling/index.js +2 -29
- package/dist/scheduling-CPiEdtQd.js +839 -0
- package/dist/storage/index.js +2 -15
- package/dist/storage-tWHMv2H_.js +841 -0
- package/dist/support/expiry.js +69 -12
- package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
- package/dist/vite/index.js +118 -181
- package/dist/vite/plugin.d.ts +1 -1
- package/dist/vite-dev-server-BSJkduhZ.js +131 -0
- package/package.json +6 -5
- package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
- package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
- package/dist/chunk-2SC566CD.js +0 -376
- package/dist/chunk-2V3YID4H.js +0 -20
- package/dist/chunk-3KV5X2FL.js +0 -31
- package/dist/chunk-63SKW5PS.js +0 -457
- package/dist/chunk-6J6B5KOB.js +0 -425
- package/dist/chunk-A5JJ7XTH.js +0 -24
- package/dist/chunk-AZOYI43J.js +0 -18
- package/dist/chunk-B5E5VBDI.js +0 -115
- package/dist/chunk-DAQKYKLH.js +0 -182
- package/dist/chunk-DRNPVBAA.js +0 -1002
- package/dist/chunk-EI5GYMAT.js +0 -853
- package/dist/chunk-H3B23O6T.js +0 -271
- package/dist/chunk-HPET6XY5.js +0 -853
- package/dist/chunk-HR2KZ3WL.js +0 -616
- package/dist/chunk-IOTWFHZU.js +0 -558
- package/dist/chunk-K6CUBJX6.js +0 -642
- package/dist/chunk-KTNJG7R7.js +0 -911
- package/dist/chunk-LAJQCSSF.js +0 -355
- package/dist/chunk-LHR6OHI7.js +0 -189
- package/dist/chunk-N7PLD7MB.js +0 -729
- package/dist/chunk-Q2P6YLRR.js +0 -24
- package/dist/chunk-QQKTH5KX.js +0 -114
- package/dist/chunk-SFQP6O52.js +0 -126
- package/dist/chunk-SQR7277M.js +0 -911
- package/dist/chunk-T2FFUU6J.js +0 -484
- package/dist/chunk-TVV5YNEC.js +0 -1842
- package/dist/chunk-UY3AZSYL.js +0 -14
- package/dist/chunk-V4DNC2ER.js +0 -114
- package/dist/chunk-VSA3QY5Q.js +0 -274
- package/dist/chunk-YSOJKAAU.js +0 -427
- package/dist/errors-PUNHAFL2.js +0 -34
package/dist/chunk-YSOJKAAU.js
DELETED
|
@@ -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
|
-
};
|
package/dist/errors-PUNHAFL2.js
DELETED
|
@@ -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
|
-
};
|