@beignet/cli 0.0.38 → 0.0.40
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 +18 -0
- package/README.md +154 -102
- package/dist/choices.d.ts +17 -21
- package/dist/choices.d.ts.map +1 -1
- package/dist/choices.js +21 -67
- package/dist/choices.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/create-prompts.d.ts +5 -6
- package/dist/create-prompts.d.ts.map +1 -1
- package/dist/create-prompts.js +15 -15
- package/dist/create-prompts.js.map +1 -1
- package/dist/create.d.ts +11 -2
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +38 -28
- package/dist/create.js.map +1 -1
- package/dist/framework.d.ts +3 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +6 -0
- package/dist/framework.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +149 -47
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +4 -2
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +174 -34
- package/dist/inspect.js.map +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/make/inbox.js +3 -3
- package/dist/make/inbox.js.map +1 -1
- package/dist/make/payments.d.ts.map +1 -1
- package/dist/make/payments.js +5 -3
- package/dist/make/payments.js.map +1 -1
- package/dist/make/shared.d.ts +10 -3
- package/dist/make/shared.d.ts.map +1 -1
- package/dist/make/shared.js +7 -8
- package/dist/make/shared.js.map +1 -1
- package/dist/make.d.ts +3 -2
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +549 -186
- package/dist/make.js.map +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +15 -11
- package/dist/mcp.js.map +1 -1
- package/dist/provider-add.d.ts +21 -3
- package/dist/provider-add.d.ts.map +1 -1
- package/dist/provider-add.js +101 -65
- package/dist/provider-add.js.map +1 -1
- package/dist/task.js +1 -1
- package/dist/task.js.map +1 -1
- package/dist/templates/base.d.ts +1 -1
- package/dist/templates/base.d.ts.map +1 -1
- package/dist/templates/base.js +15 -15
- package/dist/templates/base.js.map +1 -1
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +5 -5
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/server.d.ts.map +1 -1
- package/dist/templates/server.js +17 -13
- package/dist/templates/server.js.map +1 -1
- package/dist/templates/shadcn.js +1 -1
- package/dist/templates/shared.d.ts +4 -4
- package/dist/templates/shared.d.ts.map +1 -1
- package/dist/templates/shared.js +6 -6
- package/dist/templates/shared.js.map +1 -1
- package/package.json +2 -2
- package/skills/app-structure/SKILL.md +29 -9
- package/src/choices.ts +38 -88
- package/src/config.ts +7 -3
- package/src/create-prompts.ts +20 -21
- package/src/create.ts +54 -36
- package/src/framework.ts +13 -0
- package/src/index.ts +193 -65
- package/src/inspect.ts +290 -39
- package/src/lib.ts +1 -1
- package/src/make/inbox.ts +3 -3
- package/src/make/payments.ts +10 -3
- package/src/make/shared.ts +16 -10
- package/src/make.ts +720 -176
- package/src/mcp.ts +20 -13
- package/src/provider-add.ts +159 -79
- package/src/task.ts +1 -1
- package/src/templates/base.ts +16 -16
- package/src/templates/index.ts +6 -6
- package/src/templates/server.ts +17 -13
- package/src/templates/shadcn.ts +1 -1
- package/src/templates/shared.ts +10 -10
- package/src/test-helpers/generated-app.ts +2 -1
package/src/templates/base.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { databaseLocalUrl, databaseStartCommand } from "../choices.js";
|
|
|
2
2
|
import { shadcnDependencies, shadcnDevDependencies } from "./shadcn.js";
|
|
3
3
|
import {
|
|
4
4
|
externalVersions,
|
|
5
|
-
|
|
6
|
-
integrationDeps,
|
|
5
|
+
hasStarterProvider,
|
|
7
6
|
json,
|
|
8
7
|
packageRunner,
|
|
8
|
+
starterProviderDeps,
|
|
9
9
|
type TemplateContext,
|
|
10
10
|
} from "./shared.js";
|
|
11
11
|
import { shellDependencies, shellDevDependencies } from "./shell.js";
|
|
@@ -55,9 +55,9 @@ export function packageJson(ctx: TemplateContext): string {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
for (const
|
|
58
|
+
for (const provider of ctx.providers) {
|
|
59
59
|
for (const [name, version] of Object.entries(
|
|
60
|
-
|
|
60
|
+
starterProviderDeps[provider],
|
|
61
61
|
)) {
|
|
62
62
|
dependencies[name] = version || ctx.beignetVersion;
|
|
63
63
|
}
|
|
@@ -356,10 +356,10 @@ ${optionalAuthRedirects}
|
|
|
356
356
|
: "; it refuses non-local hosts unless `BEIGNET_ALLOW_DATABASE_RESET=true`"
|
|
357
357
|
}.
|
|
358
358
|
- Remove \`DEVTOOLS_ENABLED=true\` in production unless you add authentication and stricter redaction.
|
|
359
|
-
- Set \`APP_URL\`, \`BETTER_AUTH_SECRET\`, \`LOG_LEVEL\`, and
|
|
359
|
+
- Set \`APP_URL\`, \`BETTER_AUTH_SECRET\`, \`LOG_LEVEL\`, and provider-specific variables in your hosting environment.
|
|
360
360
|
- Set \`BETTER_AUTH_TRUSTED_ORIGINS\` before serving auth across multiple origins.
|
|
361
361
|
- Review the starter authorization policy before exposing user-owned data.
|
|
362
|
-
${ctx.
|
|
362
|
+
${ctx.providers.length > 0 ? "\nSee `docs/providers.md` for setup notes.\n" : ""}`;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
function intentRunner(ctx: TemplateContext): string {
|
|
@@ -375,16 +375,16 @@ function intentRunner(ctx: TemplateContext): string {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
export function
|
|
378
|
+
export function providersDoc(ctx: TemplateContext): string {
|
|
379
379
|
const lines = [
|
|
380
|
-
"#
|
|
380
|
+
"# Providers",
|
|
381
381
|
"",
|
|
382
|
-
"The starter app added dependencies for the
|
|
382
|
+
"The starter app added dependencies for the providers you selected. Runtime providers are wired in `server/providers.ts` when Beignet can do so safely; providers that need app-owned setup list their follow-up steps below.",
|
|
383
383
|
"",
|
|
384
384
|
];
|
|
385
385
|
|
|
386
|
-
for (const
|
|
387
|
-
if (
|
|
386
|
+
for (const provider of ctx.providers) {
|
|
387
|
+
if (provider === "jobs-inngest") {
|
|
388
388
|
lines.push(
|
|
389
389
|
"## Inngest jobs",
|
|
390
390
|
"",
|
|
@@ -398,7 +398,7 @@ export function integrationsDoc(ctx: TemplateContext): string {
|
|
|
398
398
|
);
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
if (
|
|
401
|
+
if (provider === "mail-resend") {
|
|
402
402
|
lines.push(
|
|
403
403
|
"## Resend mail",
|
|
404
404
|
"",
|
|
@@ -410,7 +410,7 @@ export function integrationsDoc(ctx: TemplateContext): string {
|
|
|
410
410
|
);
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
if (
|
|
413
|
+
if (provider === "rate-limit-upstash") {
|
|
414
414
|
lines.push(
|
|
415
415
|
"## Upstash rate limit",
|
|
416
416
|
"",
|
|
@@ -470,11 +470,11 @@ export function envExample(ctx: TemplateContext): string {
|
|
|
470
470
|
"",
|
|
471
471
|
];
|
|
472
472
|
|
|
473
|
-
if (
|
|
473
|
+
if (hasStarterProvider(ctx, "jobs-inngest")) {
|
|
474
474
|
lines.push("INNGEST_APP_NAME=beignet-app", "# INNGEST_EVENT_KEY=", "");
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
-
if (
|
|
477
|
+
if (hasStarterProvider(ctx, "mail-resend")) {
|
|
478
478
|
lines.push(
|
|
479
479
|
"# Dev placeholders keep the app bootable; set real Resend values before sending mail.",
|
|
480
480
|
"RESEND_API_KEY=dev-placeholder-change-me",
|
|
@@ -483,7 +483,7 @@ export function envExample(ctx: TemplateContext): string {
|
|
|
483
483
|
);
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
if (
|
|
486
|
+
if (hasStarterProvider(ctx, "rate-limit-upstash")) {
|
|
487
487
|
lines.push(
|
|
488
488
|
"# Dev placeholders keep the app bootable; set real Upstash values before rate limiting.",
|
|
489
489
|
"UPSTASH_REDIS_REST_URL=https://dev-placeholder.upstash.io",
|
package/src/templates/index.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export type {
|
|
2
2
|
DatabaseName,
|
|
3
|
-
IntegrationName,
|
|
4
3
|
PackageManager,
|
|
4
|
+
StarterProviderName,
|
|
5
5
|
TemplateName,
|
|
6
6
|
} from "../choices.js";
|
|
7
|
-
export { databaseChoices,
|
|
7
|
+
export { databaseChoices, starterProviderChoices } from "../choices.js";
|
|
8
8
|
export type { TemplateContext, TemplateFile } from "./shared.js";
|
|
9
9
|
|
|
10
10
|
import { agentsMd, mcpJson } from "./agents.js";
|
|
11
11
|
import {
|
|
12
12
|
baseFiles,
|
|
13
13
|
envExample,
|
|
14
|
-
integrationsDoc,
|
|
15
14
|
packageJson,
|
|
15
|
+
providersDoc,
|
|
16
16
|
readme,
|
|
17
17
|
} from "./base.js";
|
|
18
18
|
import { dbFiles } from "./db/index.js";
|
|
@@ -154,10 +154,10 @@ export function getTemplateFiles(ctx: TemplateContext): TemplateFile[] {
|
|
|
154
154
|
templateFiles.push(...shadcnTemplateFiles(), ...shellTemplateFiles(ctx));
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
if (ctx.
|
|
157
|
+
if (ctx.providers.length > 0) {
|
|
158
158
|
templateFiles.push({
|
|
159
|
-
path: "docs/
|
|
160
|
-
content:
|
|
159
|
+
path: "docs/providers.md",
|
|
160
|
+
content: providersDoc(ctx),
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
|
package/src/templates/server.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { databaseLocalUrl } from "../choices.js";
|
|
2
2
|
import {
|
|
3
3
|
databaseDescriptor,
|
|
4
|
-
|
|
4
|
+
hasStarterProvider,
|
|
5
5
|
type TemplateContext,
|
|
6
6
|
} from "./shared.js";
|
|
7
7
|
|
|
@@ -12,14 +12,14 @@ export function serverProviders(ctx: TemplateContext): string {
|
|
|
12
12
|
'import { createDevtoolsProvider } from "@beignet/devtools";',
|
|
13
13
|
'import { createBetterAuthProvider } from "@beignet/provider-auth-better-auth";',
|
|
14
14
|
`import { ${db.providerFactory} } from "@beignet/provider-db-drizzle/${db.subpath}";`,
|
|
15
|
-
|
|
15
|
+
hasStarterProvider(ctx, "jobs-inngest")
|
|
16
16
|
? 'import { createInngestJobsProvider } from "@beignet/provider-jobs-inngest";'
|
|
17
17
|
: undefined,
|
|
18
18
|
'import { createPinoLoggerProvider } from "@beignet/provider-logger-pino";',
|
|
19
|
-
|
|
19
|
+
hasStarterProvider(ctx, "mail-resend")
|
|
20
20
|
? 'import { createResendMailProvider } from "@beignet/provider-mail-resend";'
|
|
21
21
|
: undefined,
|
|
22
|
-
|
|
22
|
+
hasStarterProvider(ctx, "rate-limit-upstash")
|
|
23
23
|
? 'import { createUpstashRateLimitProvider } from "@beignet/provider-rate-limit-upstash";'
|
|
24
24
|
: undefined,
|
|
25
25
|
'import * as schema from "@/infra/db/schema";',
|
|
@@ -35,11 +35,13 @@ export function serverProviders(ctx: TemplateContext): string {
|
|
|
35
35
|
"\tcreatePinoLoggerProvider(),",
|
|
36
36
|
`\t${db.providerInstance},`,
|
|
37
37
|
"\tstarterDatabaseProvider,",
|
|
38
|
-
|
|
38
|
+
hasStarterProvider(ctx, "jobs-inngest")
|
|
39
39
|
? "\tcreateInngestJobsProvider(),"
|
|
40
40
|
: undefined,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
hasStarterProvider(ctx, "mail-resend")
|
|
42
|
+
? "\tcreateResendMailProvider(),"
|
|
43
|
+
: undefined,
|
|
44
|
+
hasStarterProvider(ctx, "rate-limit-upstash")
|
|
43
45
|
? "\tcreateUpstashRateLimitProvider(),"
|
|
44
46
|
: undefined,
|
|
45
47
|
].filter((entry): entry is string => Boolean(entry));
|
|
@@ -58,9 +60,9 @@ ${entries.join("\n")}
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
export function ports(ctx: TemplateContext): string {
|
|
61
|
-
const usesInngest =
|
|
62
|
-
const usesResend =
|
|
63
|
-
const usesUpstash =
|
|
63
|
+
const usesInngest = hasStarterProvider(ctx, "jobs-inngest");
|
|
64
|
+
const usesResend = hasStarterProvider(ctx, "mail-resend");
|
|
65
|
+
const usesUpstash = hasStarterProvider(ctx, "rate-limit-upstash");
|
|
64
66
|
const coreImports = [
|
|
65
67
|
"\tBoundGate,",
|
|
66
68
|
"\tGatePort,",
|
|
@@ -105,10 +107,12 @@ export function portWiring(ctx: TemplateContext): string {
|
|
|
105
107
|
const deferred = [
|
|
106
108
|
'\t\t"auth",',
|
|
107
109
|
'\t\t"idempotency",',
|
|
108
|
-
|
|
110
|
+
hasStarterProvider(ctx, "jobs-inngest") ? '\t\t"jobs",' : undefined,
|
|
109
111
|
'\t\t"logger",',
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
hasStarterProvider(ctx, "mail-resend") ? '\t\t"mailer",' : undefined,
|
|
113
|
+
hasStarterProvider(ctx, "rate-limit-upstash")
|
|
114
|
+
? '\t\t"rateLimit",'
|
|
115
|
+
: undefined,
|
|
112
116
|
'\t\t"todos",',
|
|
113
117
|
'\t\t"uow",',
|
|
114
118
|
].filter((entry): entry is string => Boolean(entry));
|
package/src/templates/shadcn.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { TemplateFile } from "./shared.js";
|
|
|
6
6
|
* uses.
|
|
7
7
|
*
|
|
8
8
|
* The config, tokens, and most primitives are vendored byte-identically from
|
|
9
|
-
* `apps/example-twitter-clone` (shadcn style "radix-nova"), which is the
|
|
9
|
+
* `apps/example-next-twitter-clone` (shadcn style "radix-nova"), which is the
|
|
10
10
|
* repo's source of truth for this stack. `checkbox` and `label` are ported
|
|
11
11
|
* from the radix-nova registry following the same conventions.
|
|
12
12
|
*/
|
package/src/templates/shared.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
DatabaseName,
|
|
3
|
-
IntegrationName,
|
|
4
3
|
PackageManager,
|
|
4
|
+
StarterProviderName,
|
|
5
5
|
} from "../choices.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -23,7 +23,7 @@ export type TemplateContext = {
|
|
|
23
23
|
* When true, scaffold an API-only app without the UI shell.
|
|
24
24
|
*/
|
|
25
25
|
api: boolean;
|
|
26
|
-
|
|
26
|
+
providers: StarterProviderName[];
|
|
27
27
|
/**
|
|
28
28
|
* Database backing the starter's Drizzle persistence layer.
|
|
29
29
|
*/
|
|
@@ -169,30 +169,30 @@ export function packageRunner(ctx: TemplateContext): string {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
export const
|
|
173
|
-
|
|
172
|
+
export const starterProviderDeps: Record<
|
|
173
|
+
StarterProviderName,
|
|
174
174
|
Record<string, string>
|
|
175
175
|
> = {
|
|
176
|
-
inngest: {
|
|
176
|
+
"jobs-inngest": {
|
|
177
177
|
"@beignet/provider-jobs-inngest": "",
|
|
178
178
|
inngest: externalVersions.inngest,
|
|
179
179
|
},
|
|
180
|
-
resend: {
|
|
180
|
+
"mail-resend": {
|
|
181
181
|
"@beignet/provider-mail-resend": "",
|
|
182
182
|
resend: externalVersions.resend,
|
|
183
183
|
},
|
|
184
|
-
"
|
|
184
|
+
"rate-limit-upstash": {
|
|
185
185
|
"@beignet/provider-rate-limit-upstash": "",
|
|
186
186
|
"@upstash/ratelimit": externalVersions.upstashRateLimit,
|
|
187
187
|
"@upstash/redis": externalVersions.upstashRedis,
|
|
188
188
|
},
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
export function
|
|
191
|
+
export function hasStarterProvider(
|
|
192
192
|
ctx: TemplateContext,
|
|
193
|
-
|
|
193
|
+
provider: StarterProviderName,
|
|
194
194
|
): boolean {
|
|
195
|
-
return ctx.
|
|
195
|
+
return ctx.providers.includes(provider);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
export function json(value: unknown): string {
|
|
@@ -37,6 +37,7 @@ export async function linkSmokeDependencies(
|
|
|
37
37
|
"provider-storage-local",
|
|
38
38
|
"react-hook-form",
|
|
39
39
|
"react-query",
|
|
40
|
+
"react-uploads",
|
|
40
41
|
"web",
|
|
41
42
|
];
|
|
42
43
|
|
|
@@ -49,7 +50,7 @@ export async function linkSmokeDependencies(
|
|
|
49
50
|
|
|
50
51
|
const externalSource = path.join(
|
|
51
52
|
repoRoot,
|
|
52
|
-
"apps/example-linear-clone/node_modules",
|
|
53
|
+
"apps/example-next-linear-clone/node_modules",
|
|
53
54
|
);
|
|
54
55
|
const externalPackages = [
|
|
55
56
|
"@electric-sql/pglite",
|