@beignet/cli 0.0.14 → 0.0.16
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 +35 -0
- package/README.md +30 -22
- package/dist/choices.d.ts +1 -1
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +8 -0
- package/dist/choices.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/inspect.js +12 -3
- package/dist/inspect.js.map +1 -1
- package/dist/make.d.ts +14 -0
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +622 -17
- package/dist/make.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +12 -4
- package/dist/mcp.js.map +1 -1
- package/dist/templates/agents.d.ts +2 -2
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +18 -15
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/base.js +1 -1
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +13 -6
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shared.js +3 -3
- package/dist/templates/shared.js.map +1 -1
- package/dist/templates/shell.d.ts.map +1 -1
- package/dist/templates/shell.js +2 -2
- package/dist/templates/shell.js.map +1 -1
- package/dist/templates/todos.js +1 -1
- package/package.json +2 -2
- package/src/choices.ts +8 -0
- package/src/index.ts +35 -2
- package/src/inspect.ts +15 -3
- package/src/make.ts +876 -18
- package/src/mcp.ts +12 -3
- package/src/templates/agents.ts +18 -16
- package/src/templates/base.ts +3 -3
- package/src/templates/server.ts +13 -6
- package/src/templates/shared.ts +3 -3
- package/src/templates/shell.ts +2 -1
- package/src/templates/todos.ts +1 -1
- package/dist/templates/db.d.ts +0 -15
- package/dist/templates/db.d.ts.map +0 -1
- package/dist/templates/db.js +0 -1001
- package/dist/templates/db.js.map +0 -1
package/src/mcp.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
makeJob,
|
|
16
16
|
makeListener,
|
|
17
17
|
makeNotification,
|
|
18
|
+
makeOutbox,
|
|
18
19
|
makePayments,
|
|
19
20
|
makePolicy,
|
|
20
21
|
makePort,
|
|
@@ -44,6 +45,7 @@ const makeArtifactChoices = [
|
|
|
44
45
|
"job",
|
|
45
46
|
"listener",
|
|
46
47
|
"notification",
|
|
48
|
+
"outbox",
|
|
47
49
|
"payments",
|
|
48
50
|
"policy",
|
|
49
51
|
"port",
|
|
@@ -66,13 +68,13 @@ const makeInputSchema = {
|
|
|
66
68
|
.string()
|
|
67
69
|
.optional()
|
|
68
70
|
.describe(
|
|
69
|
-
"Artifact name. Required except for payments. Feature-owned artifacts use feature-scoped paths such as posts/backfill.",
|
|
71
|
+
"Artifact name. Required except for outbox and payments. Feature-owned artifacts use feature-scoped paths such as posts/backfill.",
|
|
70
72
|
),
|
|
71
73
|
with: z
|
|
72
74
|
.array(z.enum(makeFeatureAddonChoices))
|
|
73
75
|
.optional()
|
|
74
76
|
.describe(
|
|
75
|
-
"feature only: add feature-owned artifacts such as policy, events, jobs, notifications, tasks, ui, and uploads.",
|
|
77
|
+
"feature only: add feature-owned artifacts such as policy, factories, seeds, events, listeners, jobs, notifications, schedules, tasks, ui, and uploads.",
|
|
76
78
|
),
|
|
77
79
|
event: z
|
|
78
80
|
.string()
|
|
@@ -186,6 +188,13 @@ async function runMakeTool(
|
|
|
186
188
|
dryRun: input.dryRun,
|
|
187
189
|
});
|
|
188
190
|
}
|
|
191
|
+
if (input.artifact === "outbox") {
|
|
192
|
+
return makeOutbox({
|
|
193
|
+
cwd,
|
|
194
|
+
force: input.force,
|
|
195
|
+
dryRun: input.dryRun,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
189
198
|
if (!input.name) {
|
|
190
199
|
throw new Error(`make ${input.artifact} requires a name.`);
|
|
191
200
|
}
|
|
@@ -352,7 +361,7 @@ export function buildBeignetMcpServer(options: McpServerOptions): McpServer {
|
|
|
352
361
|
"make",
|
|
353
362
|
{
|
|
354
363
|
description:
|
|
355
|
-
"Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, job, listener, notification, policy, port, resource, schedule, seed, task, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts auth, tenant, events, softDelete; listener requires event; schedule accepts cron, timezone, route. All artifacts accept force and dryRun. Returns created, updated, and skipped files as JSON.",
|
|
364
|
+
"Generate Beignet app files for one artifact: adapter, contract, event, factory, feature, job, listener, notification, outbox, payments, policy, port, resource, schedule, seed, task, test, upload, or use-case. Generators auto-register artifacts, so doctor stays clean. Options by artifact: feature accepts with (addons); resource accepts auth, tenant, events, softDelete; listener requires event; schedule accepts cron, timezone, route. All artifacts accept force and dryRun. Returns created, updated, and skipped files as JSON.",
|
|
356
365
|
inputSchema: makeInputSchema,
|
|
357
366
|
},
|
|
358
367
|
async (input) =>
|
package/src/templates/agents.ts
CHANGED
|
@@ -32,10 +32,10 @@ https://beignetjs.com (agent-friendly index at https://beignetjs.com/llms.txt).
|
|
|
32
32
|
README.md covers setup and the app map; this file covers what is not
|
|
33
33
|
discoverable from the code.
|
|
34
34
|
|
|
35
|
-
## Registration is
|
|
35
|
+
## Registration is explicit
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
a silent failure — the file exists but never runs:
|
|
37
|
+
Hand-writing an artifact file does not wire it into the app. Non-registration
|
|
38
|
+
is a silent failure — the file exists but never runs:
|
|
39
39
|
|
|
40
40
|
- Feature route groups in \`features/<feature>/routes.ts\` must be composed in
|
|
41
41
|
\`server/routes.ts\` via \`defineRoutes([...])\`.
|
|
@@ -47,9 +47,12 @@ a silent failure — the file exists but never runs:
|
|
|
47
47
|
wiring.
|
|
48
48
|
|
|
49
49
|
The starter ships no workflow registries — generators create them on first
|
|
50
|
-
use, so their absence is fine. \`${cli}
|
|
51
|
-
\`${cli}
|
|
52
|
-
|
|
50
|
+
use, so their absence is fine. \`${cli} make event\`, \`${cli} make job\`,
|
|
51
|
+
\`${cli} make schedule\`, \`${cli} make task\`, \`${cli} make seed\`, and
|
|
52
|
+
\`${cli} make upload\` create or update their required app entrypoints.
|
|
53
|
+
\`${cli} doctor\` detects registration drift. \`${cli} doctor --fix\` repairs
|
|
54
|
+
route-group, schedule, task, and outbox registration; listener drift is
|
|
55
|
+
report-only and must be fixed by hand.
|
|
53
56
|
|
|
54
57
|
## Prefer generators
|
|
55
58
|
|
|
@@ -90,26 +93,25 @@ ${typecheck}
|
|
|
90
93
|
|
|
91
94
|
## MCP server
|
|
92
95
|
|
|
93
|
-
\`.mcp.json\` registers the
|
|
94
|
-
routes/doctor/lint/make as
|
|
95
|
-
\`
|
|
96
|
-
\`.mcp.json\` can
|
|
96
|
+
\`.mcp.json\` registers the app-local \`@beignet/cli\` bin at
|
|
97
|
+
\`./node_modules/.bin/beignet mcp\`, which exposes routes/doctor/lint/make as
|
|
98
|
+
structured tools named exactly: \`routes\`, \`doctor\`, \`doctor_fix\`,
|
|
99
|
+
\`lint\`, \`make\`. Clients that do not read \`.mcp.json\` can use the same
|
|
100
|
+
command from the app root; use \`${cli} mcp\` only for terminal debugging.
|
|
97
101
|
`;
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
/**
|
|
101
105
|
* .mcp.json registers the `beignet mcp` stdio server for MCP-aware clients.
|
|
102
106
|
* The runner must not print banners on stdout, which corrupts JSON-RPC, so
|
|
103
|
-
* the config launches the locally installed CLI bin
|
|
107
|
+
* the config launches the locally installed CLI bin directly.
|
|
104
108
|
*/
|
|
105
|
-
export function mcpJson(
|
|
106
|
-
const command = ctx.packageManager === "bun" ? "bunx" : "npx";
|
|
107
|
-
|
|
109
|
+
export function mcpJson(_ctx: TemplateContext): string {
|
|
108
110
|
return json({
|
|
109
111
|
mcpServers: {
|
|
110
112
|
beignet: {
|
|
111
|
-
command,
|
|
112
|
-
args: ["
|
|
113
|
+
command: "./node_modules/.bin/beignet",
|
|
114
|
+
args: ["mcp"],
|
|
113
115
|
},
|
|
114
116
|
},
|
|
115
117
|
});
|
package/src/templates/base.ts
CHANGED
|
@@ -321,11 +321,11 @@ export function integrationsDoc(ctx: TemplateContext): string {
|
|
|
321
321
|
"## Inngest",
|
|
322
322
|
"",
|
|
323
323
|
"- Package: `@beignet/core` (`@beignet/core/events`, `@beignet/core/jobs`)",
|
|
324
|
-
"- Package: `@beignet/provider-inngest`",
|
|
324
|
+
"- Package: `@beignet/provider-jobs-inngest`",
|
|
325
325
|
"- Peer dependency: `inngest`",
|
|
326
|
-
"- The starter wires `
|
|
326
|
+
"- The starter wires `inngestJobsProvider` in `server/providers.ts`.",
|
|
327
327
|
"- Define jobs with `defineJob(...)` and dispatch them through `ctx.ports.jobs.dispatch(...)`.",
|
|
328
|
-
"-
|
|
328
|
+
"- Use `ctx.ports.inngest` only as an escape hatch for Inngest-specific workflow APIs; prefer `ctx.ports.jobs.dispatch(...)` for Beignet jobs.",
|
|
329
329
|
"",
|
|
330
330
|
);
|
|
331
331
|
}
|
package/src/templates/server.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function serverProviders(ctx: TemplateContext): string {
|
|
|
13
13
|
'import { createAuthBetterAuthProvider } from "@beignet/provider-auth-better-auth";',
|
|
14
14
|
`import { ${db.providerFactory} } from "@beignet/provider-db-drizzle/${db.subpath}";`,
|
|
15
15
|
hasIntegration(ctx, "inngest")
|
|
16
|
-
? 'import {
|
|
16
|
+
? 'import { inngestJobsProvider } from "@beignet/provider-jobs-inngest";'
|
|
17
17
|
: undefined,
|
|
18
18
|
'import { loggerPinoProvider } from "@beignet/provider-logger-pino";',
|
|
19
19
|
hasIntegration(ctx, "resend")
|
|
@@ -34,7 +34,7 @@ export function serverProviders(ctx: TemplateContext): string {
|
|
|
34
34
|
"\tloggerPinoProvider,",
|
|
35
35
|
`\t${db.providerInstance},`,
|
|
36
36
|
"\tstarterDatabaseProvider,",
|
|
37
|
-
hasIntegration(ctx, "inngest") ? "\
|
|
37
|
+
hasIntegration(ctx, "inngest") ? "\tinngestJobsProvider," : undefined,
|
|
38
38
|
hasIntegration(ctx, "resend") ? "\tmailResendProvider," : undefined,
|
|
39
39
|
hasIntegration(ctx, "upstash-rate-limit")
|
|
40
40
|
? "\tupstashRateLimitProvider,"
|
|
@@ -67,7 +67,8 @@ export function ports(ctx: TemplateContext): string {
|
|
|
67
67
|
? 'import type { MailerPort } from "@beignet/core/mail";\n'
|
|
68
68
|
: "";
|
|
69
69
|
|
|
70
|
-
return `import type {
|
|
70
|
+
return `import type { ErrorReporterPort } from "@beignet/core/error-reporting";
|
|
71
|
+
import type { IdempotencyPort } from "@beignet/core/idempotency";
|
|
71
72
|
${mailImport}import type {
|
|
72
73
|
${coreImports.join("\n")}
|
|
73
74
|
} from "@beignet/core/ports";
|
|
@@ -84,6 +85,7 @@ export type AppGate = BoundGate<[typeof todoPolicy]>;
|
|
|
84
85
|
|
|
85
86
|
export type AppPorts = {
|
|
86
87
|
auth: AuthPort;
|
|
88
|
+
errorReporter: ErrorReporterPort;
|
|
87
89
|
gate: GatePort<AuthorizationContext, [typeof todoPolicy]>;
|
|
88
90
|
idempotency: IdempotencyPort;
|
|
89
91
|
${usesInngest ? "\tjobs: JobDispatcherPort;\n" : ""} logger: LoggerPort;
|
|
@@ -105,7 +107,8 @@ export function infrastructurePorts(ctx: TemplateContext): string {
|
|
|
105
107
|
'\t\t"uow",',
|
|
106
108
|
].filter((entry): entry is string => Boolean(entry));
|
|
107
109
|
|
|
108
|
-
return `import {
|
|
110
|
+
return `import { createNoopErrorReporter } from "@beignet/core/error-reporting";
|
|
111
|
+
import { createGate, definePorts } from "@beignet/core/ports";
|
|
109
112
|
import { todoPolicy } from "@/features/todos/policy";
|
|
110
113
|
import { appError } from "@/features/shared/errors";
|
|
111
114
|
import type { AppPorts } from "@/ports";
|
|
@@ -129,6 +132,7 @@ const gate = createGate({
|
|
|
129
132
|
*/
|
|
130
133
|
export const appPorts = definePorts<AppPorts>()({
|
|
131
134
|
bound: {
|
|
135
|
+
errorReporter: createNoopErrorReporter(),
|
|
132
136
|
gate,
|
|
133
137
|
},
|
|
134
138
|
deferred: [
|
|
@@ -281,7 +285,7 @@ export function server(ctx: TemplateContext): string {
|
|
|
281
285
|
|
|
282
286
|
return `import type { beignetServerOnly } from "@beignet/core/server-only";
|
|
283
287
|
import { createNextServer } from "@beignet/next";
|
|
284
|
-
import { createIdempotencyHooks } from "@beignet/core/server";
|
|
288
|
+
import { createErrorReportingHooks, createIdempotencyHooks } from "@beignet/core/server";
|
|
285
289
|
import type { AppContext } from "@/app-context";
|
|
286
290
|
import { appPorts } from "@/infra/app-ports";
|
|
287
291
|
import { env } from "@/lib/env";
|
|
@@ -295,7 +299,10 @@ export const server = await createNextServer({
|
|
|
295
299
|
providerConfig: {
|
|
296
300
|
${providerConfigEntries}
|
|
297
301
|
},
|
|
298
|
-
hooks: [
|
|
302
|
+
hooks: [
|
|
303
|
+
createErrorReportingHooks<AppContext>(),
|
|
304
|
+
createIdempotencyHooks<AppContext>(),
|
|
305
|
+
],
|
|
299
306
|
context: appContext,
|
|
300
307
|
routes,
|
|
301
308
|
mapUnhandledError: ({ err, ctx }) => {
|
package/src/templates/shared.ts
CHANGED
|
@@ -44,7 +44,7 @@ export const externalVersions = {
|
|
|
44
44
|
tanstackReactQuery: "^5.100.7",
|
|
45
45
|
hookformResolvers: "^5.0.0",
|
|
46
46
|
reactHookForm: "^7.74.0",
|
|
47
|
-
betterAuth: "1.6.
|
|
47
|
+
betterAuth: "1.6.20",
|
|
48
48
|
drizzleKit: "^0.31.10",
|
|
49
49
|
drizzleOrm: "^0.45.2",
|
|
50
50
|
inngest: "^3.0.0",
|
|
@@ -53,7 +53,7 @@ export const externalVersions = {
|
|
|
53
53
|
pg: "^8.13.0",
|
|
54
54
|
pglite: "^0.5.2",
|
|
55
55
|
pino: "^9.7.0",
|
|
56
|
-
resend: "^
|
|
56
|
+
resend: "^6.14.0",
|
|
57
57
|
typesPg: "^8.11.0",
|
|
58
58
|
upstashRateLimit: "^2.0.0",
|
|
59
59
|
upstashRedis: "^1.0.0",
|
|
@@ -154,7 +154,7 @@ export const integrationDeps: Record<
|
|
|
154
154
|
Record<string, string>
|
|
155
155
|
> = {
|
|
156
156
|
inngest: {
|
|
157
|
-
"@beignet/provider-inngest": "",
|
|
157
|
+
"@beignet/provider-jobs-inngest": "",
|
|
158
158
|
inngest: externalVersions.inngest,
|
|
159
159
|
},
|
|
160
160
|
resend: {
|
package/src/templates/shell.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
externalVersions,
|
|
2
3
|
packageRunner,
|
|
3
4
|
type TemplateContext,
|
|
4
5
|
type TemplateFile,
|
|
@@ -1219,7 +1220,7 @@ export function shellTemplateFiles(ctx: TemplateContext): TemplateFile[] {
|
|
|
1219
1220
|
}
|
|
1220
1221
|
|
|
1221
1222
|
export const shellDependencies: Record<string, string> = {
|
|
1222
|
-
"better-auth":
|
|
1223
|
+
"better-auth": externalVersions.betterAuth,
|
|
1223
1224
|
"lucide-react": "^1.16.0",
|
|
1224
1225
|
"next-themes": "^0.4.6",
|
|
1225
1226
|
};
|
package/src/templates/todos.ts
CHANGED
|
@@ -190,7 +190,7 @@ import {
|
|
|
190
190
|
updateTodoUseCase,
|
|
191
191
|
} from "@/features/todos/use-cases";
|
|
192
192
|
|
|
193
|
-
export const todoRoutes = defineRouteGroup<AppContext>({
|
|
193
|
+
export const todoRoutes = defineRouteGroup<AppContext>()({
|
|
194
194
|
name: "todos",
|
|
195
195
|
routes: [
|
|
196
196
|
{ contract: listTodos, useCase: listTodosUseCase },
|
package/dist/templates/db.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare const files: {
|
|
2
|
-
drizzleConfig: string;
|
|
3
|
-
dbSchema: string;
|
|
4
|
-
drizzleTodoRepository: string;
|
|
5
|
-
dbRepositories: string;
|
|
6
|
-
databaseReady: string;
|
|
7
|
-
dbProvider: string;
|
|
8
|
-
dbReset: string;
|
|
9
|
-
dbTestDatabase: string;
|
|
10
|
-
starterMigrationSql: string;
|
|
11
|
-
starterMigrationJournal: string;
|
|
12
|
-
starterMigrationSnapshot: string;
|
|
13
|
-
};
|
|
14
|
-
export { files as dbFiles };
|
|
15
|
-
//# sourceMappingURL=db.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/templates/db.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,KAAK;;;;;;;;;;;;CA49BV,CAAC;AAEF,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,CAAC"}
|