@beignet/cli 0.0.13 → 0.0.15
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 +37 -0
- package/README.md +22 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/inspect.js +185 -2
- package/dist/inspect.js.map +1 -1
- package/dist/make.d.ts +11 -0
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +1609 -1
- package/dist/make.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +14 -2
- 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 +9 -9
- 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 +1 -1
- package/dist/templates/shared.js.map +1 -1
- package/dist/templates/todos.js +1 -1
- package/package.json +2 -2
- package/src/index.ts +35 -0
- package/src/inspect.ts +375 -2
- package/src/make.ts +1824 -1
- package/src/mcp.ts +16 -2
- package/src/templates/agents.ts +9 -10
- package/src/templates/base.ts +3 -3
- package/src/templates/server.ts +13 -6
- package/src/templates/shared.ts +1 -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
|
+
makePayments,
|
|
18
19
|
makePolicy,
|
|
19
20
|
makePort,
|
|
20
21
|
makeResource,
|
|
@@ -43,6 +44,7 @@ const makeArtifactChoices = [
|
|
|
43
44
|
"job",
|
|
44
45
|
"listener",
|
|
45
46
|
"notification",
|
|
47
|
+
"payments",
|
|
46
48
|
"policy",
|
|
47
49
|
"port",
|
|
48
50
|
"resource",
|
|
@@ -62,8 +64,9 @@ const makeInputSchema = {
|
|
|
62
64
|
.describe("Kind of artifact to generate."),
|
|
63
65
|
name: z
|
|
64
66
|
.string()
|
|
67
|
+
.optional()
|
|
65
68
|
.describe(
|
|
66
|
-
"Artifact name. Feature-owned artifacts use feature-scoped paths such as posts/backfill.",
|
|
69
|
+
"Artifact name. Required except for payments. Feature-owned artifacts use feature-scoped paths such as posts/backfill.",
|
|
67
70
|
),
|
|
68
71
|
with: z
|
|
69
72
|
.array(z.enum(makeFeatureAddonChoices))
|
|
@@ -125,7 +128,7 @@ const makeInputSchema = {
|
|
|
125
128
|
|
|
126
129
|
type MakeToolInput = {
|
|
127
130
|
artifact: MakeArtifact;
|
|
128
|
-
name
|
|
131
|
+
name?: string;
|
|
129
132
|
with?: Array<(typeof makeFeatureAddonChoices)[number]>;
|
|
130
133
|
event?: string;
|
|
131
134
|
cron?: string;
|
|
@@ -176,6 +179,17 @@ async function runMakeTool(
|
|
|
176
179
|
cwd: string,
|
|
177
180
|
input: MakeToolInput,
|
|
178
181
|
): Promise<MakeResourceResult> {
|
|
182
|
+
if (input.artifact === "payments") {
|
|
183
|
+
return makePayments({
|
|
184
|
+
cwd,
|
|
185
|
+
force: input.force,
|
|
186
|
+
dryRun: input.dryRun,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (!input.name) {
|
|
190
|
+
throw new Error(`make ${input.artifact} requires a name.`);
|
|
191
|
+
}
|
|
192
|
+
|
|
179
193
|
const base = {
|
|
180
194
|
name: input.name,
|
|
181
195
|
cwd,
|
package/src/templates/agents.ts
CHANGED
|
@@ -90,26 +90,25 @@ ${typecheck}
|
|
|
90
90
|
|
|
91
91
|
## MCP server
|
|
92
92
|
|
|
93
|
-
\`.mcp.json\` registers the
|
|
94
|
-
routes/doctor/lint/make as
|
|
95
|
-
\`
|
|
96
|
-
\`.mcp.json\` can
|
|
93
|
+
\`.mcp.json\` registers the app-local \`@beignet/cli\` bin at
|
|
94
|
+
\`./node_modules/.bin/beignet mcp\`, which exposes routes/doctor/lint/make as
|
|
95
|
+
structured tools named exactly: \`routes\`, \`doctor\`, \`doctor_fix\`,
|
|
96
|
+
\`lint\`, \`make\`. Clients that do not read \`.mcp.json\` can use the same
|
|
97
|
+
command from the app root; use \`${cli} mcp\` only for terminal debugging.
|
|
97
98
|
`;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
101
102
|
* .mcp.json registers the `beignet mcp` stdio server for MCP-aware clients.
|
|
102
103
|
* The runner must not print banners on stdout, which corrupts JSON-RPC, so
|
|
103
|
-
* the config launches the locally installed CLI bin
|
|
104
|
+
* the config launches the locally installed CLI bin directly.
|
|
104
105
|
*/
|
|
105
|
-
export function mcpJson(
|
|
106
|
-
const command = ctx.packageManager === "bun" ? "bunx" : "npx";
|
|
107
|
-
|
|
106
|
+
export function mcpJson(_ctx: TemplateContext): string {
|
|
108
107
|
return json({
|
|
109
108
|
mcpServers: {
|
|
110
109
|
beignet: {
|
|
111
|
-
command,
|
|
112
|
-
args: ["
|
|
110
|
+
command: "./node_modules/.bin/beignet",
|
|
111
|
+
args: ["mcp"],
|
|
113
112
|
},
|
|
114
113
|
},
|
|
115
114
|
});
|
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
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"}
|